-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
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:
$ curl -sSfLO https://github.com/astral-sh/uv/releases/download/0.2.32/uv-aarch64-unknown-linux-gnu.tar.gz
$ tar -zx --strip-components=1 -f uv-aarch64-unknown-linux-gnu.tar.gz
$ du -ha uv uv-*
35M uv
14M uv-aarch64-unknown-linux-gnu.tar.gz
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 .pycs 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%:
$ strip uv
$ du -ha uv
26M uv
And Cargo now supports stripping natively in a cross-platform way:
https://doc.rust-lang.org/cargo/reference/profiles.html#strip
[profile.release]
strip = trueI see this has been enabled already for the uv-trampoline crate:
uv/crates/uv-trampoline/Cargo.toml
Lines 28 to 29 in 9a1a211
| # Automatically strip symbols from the binary. | |
| strip = true |
...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