-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Right now, dockworker pulls in a ton of dependencies, the biggest probably being the entirety of the hyper stack and tokio:

(generated with cargo-deps, see the README for the color codes)
Consider this simple application:
use dockworker::*;
fn main() {
let docker = Docker::connect_with_defaults().unwrap();
match docker.list_containers(None, None, None, container::ContainerFilters::new()) {
Ok(result) => println!("{:#?}", result),
Err(e) => println!("Error connecting to docker daemon: {}", e),
}
}
Compiling this with --release results in a 5.9MB executable. Even with the tricks from min-sized-rust i couldn't get this below 1.4MB - probably 99% of that is dockworker.
And i suspect most of these 4.5MB reduction (apart from 1.2MB for stripping) is LTO getting rid of things this application doesn't need because it's so very simple.
Could some of these large dependencies be opt-out features?
For example: I assume tokio is quite interlocked with dockworker, which leaves the other big ticket, hyper. To me, it seems like requests (especially local ones) could be done even with the simplest of libraries, f.e. minreq or ureq. Maybe allow users to choose a request library, similar to SSL provider?
Thanks for considering ^^