-
Notifications
You must be signed in to change notification settings - Fork 432
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 packaged crate size by 5kb using cargo diet -r
#983
Conversation
It converted excludes into includes, removing the following files from the package. ┌───────────────────────────────────────────┬─────────────┐ │ File │ Size (Byte) │ ├───────────────────────────────────────────┼─────────────┤ │ .gitignore │ 77 │ │ .github/ISSUE_TEMPLATE/other.md │ 80 │ │ .github/ISSUE_TEMPLATE/feature_request.md │ 274 │ │ .github/ISSUE_TEMPLATE/compile-issue.md │ 488 │ │ utils/ci/install_cargo_web.sh │ 536 │ │ COPYRIGHT │ 569 │ │ utils/ci/miri.sh │ 815 │ │ rustfmt.toml │ 863 │ │ benches/weighted.rs │ 1088 │ │ utils/ci/install.sh │ 1381 │ │ utils/ci/script.sh │ 1583 │ │ examples/monte-carlo.rs │ 1611 │ │ appveyor.yml │ 2098 │ │ SECURITY.md │ 2822 │ │ .travis.yml │ 2952 │ │ utils/ziggurat_tables.py │ 3929 │ │ examples/monty-hall.rs │ 4004 │ │ benches/misc.rs │ 4524 │ │ benches/seq.rs │ 5410 │ │ benches/generators.rs │ 5490 │ └───────────────────────────────────────────┴─────────────┘
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like COPYRIGHT should be included as well. Removing the other files seems reasonable to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about Cargo.toml itself; is this implicitly included? Yes (according to doc).
Then this looks good to me.
Could you do the same for rand_distr
please (this has benches
too)?
Thanks for the hint, it's done for |
Cargo.toml
Outdated
autobenches = true | ||
edition = "2018" | ||
include = ["src/**/*", "LICENSE-*", "README.md", "CHANGELOG.md", "COPYRIGHT"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we just match src
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! I have made it 'src/' which has the same effect but makes clearer that it's a directory.
If that's not alright, please let me know and I will make it src
as originally requested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Thank you! Now we are at 35 million downloads all time, and when 70 million are reached, this change will have saved roughly 35 million * 5kb = 175gigabytes of downstream bandwidth. That must count for something :). |
Well, not quite — it takes a while to get a new version out, and even longer to get everyone updated. |
It converted excludes into includes, removing the following files
from the package.
Since this solely optimizes for size, I am happy to make the necessary adjustments to add other files back that you want to be part of the package.