-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Cut down on number formating code size #58272
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Instead of inlining the same logic into every number formatting implementation, pull it out into a function that each of the number formatting impls call into.
For smaller code size.
The generic `F` in `with_padding` was causing a bunch of stuff to get inlined that otherwise needn't be, blowing up code size.
This got the new test case's code size down from 22871 to 20609: a savings of 2262 bytes (about 10%). |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Removes some unsafe *and* saves almost half a kilobyte of code size.
b4765f7
to
2ec556c
Compare
2ec556c
to
f00f0e6
Compare
@bors r+ |
📌 Commit f00f0e6 has been approved by |
…k-Simulacrum Cut down on number formating code size r? @alexcrichton
…k-Simulacrum Cut down on number formating code size r? @alexcrichton
…k-Simulacrum Cut down on number formating code size r? @alexcrichton
Rollup of 10 pull requests Successful merges: - #58110 (libpanic_unwind => 2018) - #58167 (HirId-ify hir::BodyId) - #58202 (Ignore future deprecations in #[deprecated]) - #58272 (Cut down on number formating code size) - #58276 (Improve the error messages for missing stability attributes) - #58354 (Fix ICE and invalid filenames in MIR printing code) - #58381 (Only suggest imports if not imported.) - #58386 (Fix #54242) - #58400 (Fix rustc_driver swallowing errors when compilation is stopped) - #58420 (target/uefi: clarify documentation) Failed merges: r? @ghost
Ooh. I'm really curious to see whether this has any noticeable impact on embedded. |
Very nice! I'm seeing a reduction of up to 800B in .text size (or -28% in that specific example) on ARMv6m. |
r? @alexcrichton