-
Notifications
You must be signed in to change notification settings - Fork 765
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
Consider stripping uv
release binaries
#5683
Comments
I thought we were stripping binaries via |
I've checked locally and RUST_LOG=debug uvx maturin build --release --locked --out dist --features self-update --target x86_64-unknown-linux-gnu is correctly setting |
No idea, can you try run maturin build with |
CI also says https://github.com/astral-sh/uv/actions/runs/10213117825/job/28257883122:
So the right arg is there. Could it be it's because we're not using mold in CI? |
Have you tried comparing build artifact size with and without |
It's indeed the difference between using the standard linker and mold. If i deactivate mold locally i get the same 37MB semi-stripped binary with So i think we have to configure mold for the linux build? |
|
I'm curious, why is Maturin passing manual linker args via Did the Maturin strip feature just predate rust-lang/rust#72110? |
Yeah, the maturin option is older, we could change maturin to use the new option. |
I just checked one of our Rust project's cross-compiled binaries ( |
Reported upstream: rust-lang/cargo#14346 |
Decreases linux release wheel size by 2MB. See rust-lang/cargo#14346 Fixes #5683
Thank you! I took a quick look and this seems to be a regression from rust-lang/cargo#13257 in Rust 1.77.0. As a workaround in the meantime (and to avoid individual projects having to adjust their own Cargo.toml files), Maturin could set |
Hi 👋
Thank you for a great project!
I noticed that the
uv
release binaries (as distributed via GitHub releases) are currently quite large.For example:
To put the size in perspective, 14 MB compressed and 35 MB uncompressed is very close to the size of our entire Python 3.12 install archive, which has an archive size of 11MB and uncompressed install size of 41 MB (and this is even with that archive intentionally bundling
.pyc
s for the stdlib). For local installs the size doesn't really matter, however, in CI/CD/OCI image contexts cold caches can be prevalent and smaller OCI images are preferred (for end user UX it's not always desirable to exclude the package manager from the final run-image) etc, so large tool sizes are more noticeable.uv's focus should absolutely be speed+compatibility+features over binary size, so I'm not suggesting there should be any user-facing compromises made to reduce binary size - but it seems there might be some low hanging fruit to reduce the size?
For example, stripping reduces the binary size in the example above by 25%:
And Cargo now supports stripping natively in a cross-platform way:
https://doc.rust-lang.org/cargo/reference/profiles.html#strip
I see this has been enabled already for the
uv-trampoline
crate:uv/crates/uv-trampoline/Cargo.toml
Lines 28 to 29 in 9a1a211
...but not any of the others (in the release profile at least):
https://github.com/search?q=repo%3Aastral-sh%2Fuv+strip+language%3ATOML&type=code&l=TOML
The text was updated successfully, but these errors were encountered: