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

Report when multiple versions of a crate are in the dependency tree #13

Closed
briansmith opened this issue Mar 4, 2018 · 2 comments
Closed

Comments

@briansmith
Copy link

It is common to see, for example, Cargo.lock reference two or three versions of env_logger, log, ordermap, rand, etc. The consequence of having multiple versions of crates in the dependency tree is:

  • Each version needs to be downloaded, which slows the total from-scratch build time.
  • Usually each version needs to be built, which increases build time.
  • Often code from each version gets linked into the executable, which increases the final executable size.

In one relatively small project, I found that 10 different libraries were duplicated in our Cargo.lock. (It's too early to report the before/after size difference or built time in the project, since I'm still in the process of fixing this.)

This is the command line I use to find duplicates:

cat Cargo.lock | grep "^ \"" | cut -d " " -f 2,3 | sort | uniq | cut -d " " -f 1 | uniq -c | grep -v " 1"
@briansmith
Copy link
Author

More related to the core functionality of cargo-bloat, it would be useful to show the total size contribution to the final executable of each version of a library.

@RazrFalcon
Copy link
Owner

  1. You can use cargo tree --duplicates for this.
  2. I don't have information about crate version. So I can't implement this.

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

No branches or pull requests

2 participants