Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce dependencies / library size #88

Open
MCOfficer opened this issue Apr 15, 2020 · 2 comments
Open

Reduce dependencies / library size #88

MCOfficer opened this issue Apr 15, 2020 · 2 comments

Comments

@MCOfficer
Copy link

MCOfficer commented Apr 15, 2020

Right now, dockworker pulls in a ton of dependencies, the biggest probably being the entirety of the hyper stack and tokio:
graph
(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 ^^

@MCOfficer MCOfficer changed the title Reduce dependencies Reduce dependencies / library size Apr 15, 2020
@brightly-salty
Copy link

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.

@eldesh
Copy link
Collaborator

eldesh commented Dec 22, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants