-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Huge binary sizes #53202
Comments
There's a number of size optimizations you can make to reduce the size of binaries. This post is somewhat outdated but summarizes the main reasons; https://lifthrasiir.github.io/rustlog/why-is-a-rust-executable-large.html. |
This issue is far too broad; this is currently expected behavior for a variety of reasons. We try to only keep issues open for specific, focused things that can be resolved. Please post to https://users.rust-lang.org/ if you'd like to learn more about why this is true today, and what you can do to change it. Thanks. |
That sounds alot like 5M overhead for any binary isn't a huge enough issue for a systems programming language. If the problem is reproducibility:
On that (completely reproducable system) I still have 4.4M on a release build. Adding LTO get's me down to only 2.6M. To get a decently sized executable I have to When I asked in the IRC about this it seemed that other people had ~500K executables, without the need to turn on LTO, nor stripping their binaries. If this is truly "intended behaviour", I'll leave. But especially with the whole ecosystem, that does basically everything for you, this feels wrong. I would expect a "--release" binary to be release ready and the defaults to be decent. Sorry for wasting your time. |
rationale from stabilization PR #50265,
which unfortunately might not help in the case of |
@memoryruins Thanks for the update anyways. Have a nice day. |
In case others find this in the future, I've created a |
Update from my side: The issue has been resolved a while ago. I can't tell when exactly but the 5M overhead is gone. |
Binaries are huge (3.8M for an empty project).
I tried this code (in a cargo newly generated project's main.rs):
I expected to see this happen: Compiles to a binary that does nothing, about 500K in size
Instead, this happened: Compiles to a binary that does nothing, but is 3.8M in size
Meta
rustc --version --verbose
:r2 ./target/release/binary_name
and then executing the v command (a hex view) showed me that a large majority of the file where \xff bytes at the end of it.Additional info
I did a
rustup update
today. Before empty binaries where 5.1M in size.The text was updated successfully, but these errors were encountered: