You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 ^^
The text was updated successfully, but these errors were encountered:
MCOfficer
changed the title
Reduce dependencies
Reduce dependencies / library size
Apr 15, 2020
I'd be willing to attempt to implement this and submit a PR if it would be accepted. I anticipate updating all dependencies and replacing unmaintained ones to help a lot.
For us too, it would be desirable if we could reduce the size and memory footprint of the executable.
If it is provided with a consistent interface, then we can review it and merge it.
Right now,
dockworker
pulls in a ton of dependencies, the biggest probably being the entirety of thehyper
stack andtokio
:(generated with cargo-deps, see the README for the color codes)
Consider this simple application:
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 isdockworker
.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 ^^
The text was updated successfully, but these errors were encountered: