-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
release build produces big binary for wasm32-unknown-unknown target #53731
Comments
The names for all the non-exported functions are now included again. You need to pass Actually, considering you only have that single function, I'm not sure why it would include all the other garbage. Do you have LTO active? |
@CryZe I have not activated LTO. If I activate it the binary size will be 54k which is large again for this minimal code compared to 145B with LTO enabled and 119B without LTO enabled on nightly-2018-08-13. |
It seems like there's just a whole lot of debug info in there now that no tool seems to be able to strip away:
|
Apparently you can only have either both name sections + debug info or none atm: #53434 |
Ah thanks for the report @Mehdishojaei! As @CryZe pointed out though this is all debuginfo so it shouldn't affect the size of the final wasm binary. This is similar to the story on Linux where release binaries by default have debuginfo for the standard library. We can try to remove the sections automatically when LLD has support for doing so but we may not wish to do so by default (still undetermined) In the meantime tools like |
@alexcrichton Is this a new feature in wasm-gc, because it doesn't get removed with my slightly old-ish wasm-gc build. |
It is indeed! |
@CryZe, @alexcrichton Thanks for your answers, Yes I know great tools
For bigger wasm crates the size difference relative to |
@Mehdishojaei this is unfortunately just how debuginfo works on the wasm target right now. None of the size is code related, it's all optimized as much as we can. Almost all of the size is debuginfo/custom section related, which is trivially removable by tools. LLD may gain enough support to trim down dwarf information in the future, but currently it's not there yet. |
@alexcrichton thanks for your clarification. |
The output wasm binary for release build is 1.9M for a minimal wasm crate!
Until nightly
2018-08-13
everything was fine (119B).I tried this code:
Build command:
cargo build --release --target wasm32-unknown-unknown
I expected to see this happen:
All builds must produce small binaries.
Instead, this happened:
For toolchains until
nightly-2018-08-13
, cargo build produces 119B wasm output that is correct. But for the newer toolchains cargo build produces 1.9M wasm output!Meta
rustc --version --verbose
:rustc 1.30.0-nightly (7219130 2018-08-26)
binary: rustc
commit-hash: 7219130
commit-date: 2018-08-26
host: x86_64-apple-darwin
release: 1.30.0-nightly
LLVM version: 7.0
The text was updated successfully, but these errors were encountered: