-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Huge binary size regression at nightly-2025-01-03 #139950
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
Comments
From the list at https://github.com/rust-lang/rust/pulls?q=is%3Apr+merged%3A2025-01-01..2025-01-03+is%3Aclosed+-label%3Arollup+ it looks like #135034 is likely to have affected things, but that should have improved things rather than made them worse. Iirc there may have been some follow up there, is this still large on the latest nightly? If you get the chance, |
I tested on the latest nightly, it still produces large binary. I also did bisect using |
Does passing Cc @Noratrieb from the PR |
If I add
|
That seems like a fix rather than a regression. What was the situation prior to #131405? |
After #131405, you have to specify the strip = "symbols" to achieve the same release build binary size as before. I think the default config(without specifying any strip or debuginfo detail) should consistently produce reasonably small output. So it's a regression. |
As To summarize:
I believe that's accurate? Only debuginfo is stripped by default, for profiles that request no debuginfo to be produced. |
Sorry, I mixed up #131405 with #135034. However, it's hard for me to switch to the rust version before #131405. So.. #135034 introduced a bug that makes the binary wrongly small, then #131405 fixed this, which caused "regression". I think we can close this issue. Another optional question is, I know my project contains a lot of complex types, but half of the binary is debug symbols seems not reasonable. Is there any way(except boxing type) to limit the generated symbol length to avoid this situation? |
If you want the smallest binaries, you should strip symbols explicitly with |
I observed a huge binary size regression in my project when updating the rust version to nightly-2025-01-03.
My project repo is https://github.com/mikialex/rendiation, and the build command is using
cargo build --bin viewer --release
. The typical release build of the viewer binary is 16.6mb(in master), but for any rust version after(include) nightly-2025-01-03, the binary size regressed to 29mb, nearly doubled.I also compare the
lto=true codegen-unit=1
release config, the master version yields a 14.8mb binary, but the regressed version yields a 21.4mb binary.To reproduce this issue, simply go to the project's root, modify the rust-toolchain.toml the channel "nightly-2025-01-04"(I don't known why it's 04 not 03). It's not a small project(95k loc), I will continue trying to find simpler ways to reproduce.
Version it worked on
before rustc 1.85.0-nightly (4363f9b 2025-01-02)
It most recently worked on:
Version with regression
before rustc 1.85.0-nightly (3f43b1a 2025-01-03)
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: