-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
standard library results in enormous binaries #12199
Comments
Changing the title to what the real issue is at hand. |
The vast majority of this size is because these items are included in all rust binaries by default right now:
There are a few reasons for the inclusion of these bits:
As usual, dynamic linking binaries that are not very large in size. We have not turned this on by default due to the instability of the ABI of a library throughout recompilations. |
This issue isn't just about the initial code size when using static linking. The design of the generic functions/types in the standard library causes very bloated code. It will get a bit better when the old vector implementation is gone, but there's a serious lack of code (as in runtime machine code) reuse in most of the modules. I think we can do a lot better with a little thought put into hoisting out some code. The |
Also, |
Can you be more specific? It'll be hard to close this issue without specifics. |
Replaced with #13097. |
…ompletions, r=jonas-schievink fix: Don't show assoc. type binding completions when invalid Fixes rust-lang/rust-analyzer#12165
Avoid linting redundant closure when callee is marked `#[track_caller]` Fixes rust-lang#12199 Not sure if there's a nicer way to detect functions marked `#[track_caller]` other than by just looking at its attributes 🤔 changelog: [`redundant_closure`]: [`redundant_closure_for_method_calls`]: avoid linting closures where the function being called is marked `#[track_caller]`
The initial binary size in C is ~3-8K, while Rust binaries using the standard library start at 2MiB. This problem doesn't stop with the initial code size and continues to grow at a rate much faster than C or C++ applications performing the same work. This is not a Rust compiler issue as it doesn't occur when not using the standard library, even when using an API at the same level of abstraction.
Rust is linking dynamically against the system libraries so there's really no excuse for them being this large. The code size needs to be in the same ballpark as C++ (at most 2x or 3x as large...).
The text was updated successfully, but these errors were encountered: