-
Notifications
You must be signed in to change notification settings - Fork 13.7k
single buffer for exponent fmt of integers #145940
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
Conversation
r? @ibraheemdev rustbot has assigned @ibraheemdev. Use |
https://rust.godbolt.org/z/oe9zr1qd9 Do you want to have another look @tgross35? 🙏 I think we can (and should) format floating points in a single buffer too. If that succeeds then we can drop unstable feature numfmt, package num::fmt. ✨ |
Thanks for the ping, sure I'm happy to take the formatting followups here r? tgross35 |
640b1c3
to
f135601
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another great change! Looks mostly good, few small things and doc nits
Double checking that optimize for size job. Also don't think perf will show anything but may as well run it @bors2 try jobs=x86_64-gnu,x86_64-gnu-llvm-19-3 |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
This comment has been minimized.
This comment has been minimized.
single buffer for exponent fmt of integers try-job: x86_64-gnu try-job: x86_64-gnu-llvm-19-3
Queued 5fe1474 with parent 91edc3e, future comparison URL. |
f135601
to
fad6322
Compare
Another great review! The revision on floating points is starting to work too now. With a little luck we have this piggy washed somewhere next week. 🐷 🧼 |
This comment has been minimized.
This comment has been minimized.
fad6322
to
56e95aa
Compare
Feel free to request me for these reviews too, I've worked on those a bit. Very much looking forward to them! If you're working on these and up for it, one easy thing I've wanted for a little while is to refactor the traits a bit. Basically:
Reasoning here is that f128 probably needs a different algorithm, and some of the algorithm-specific constants on the current |
The Grisu and Dragon implementations use flt2dec::decoder::Decoded as an abstraction, which seems like an elegant solution, except maybe for the 26-byte footprint. What confuses me is the enormous amount of abstractions (and copies) that get introduced before the Decoded extraction. DecodableFloat is gone indeed. Don't need the Float abstraction either. It seems so much easier to deal with the edge cases by just calling f64::is_* in the macro_rules themselves. Enumerations FullDecoded and Sign are gone too. I'm hoping it all works out without some hidden catch. 🙏 Can you remove the S-waiting-on-author @tgross35? |
Rollup of 5 pull requests Successful merges: - #139524 (Add socket extensions for cygwin) - #145940 (single buffer for exponent fmt of integers) - #146206 (identity uses are ok, even if there are no defining uses) - #146272 (Update comment for `-Werror` on LLVM builds) - #146280 (Make `LetChainsPolicy` public for rustfmt usage) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #145940 - pascaldekloe:int-exp-tune, r=tgross35 single buffer for exponent fmt of integers No need for fragmented buffers when formatting. ``` orig.txt: fmt::write_i128_exp 143.39ns/iter +/- 0.32 orig.txt: fmt::write_i64_exp 68.72ns/iter +/- 0.03 new.txt: fmt::write_i128_exp 138.29ns/iter +/- 0.50 new.txt: fmt::write_i64_exp 58.93ns/iter +/- 4.62 ``` This patch fully eliminates unsafe pointer use (after #135265 and #136594). r? libs
Rollup of 5 pull requests Successful merges: - rust-lang/rust#139524 (Add socket extensions for cygwin) - rust-lang/rust#145940 (single buffer for exponent fmt of integers) - rust-lang/rust#146206 (identity uses are ok, even if there are no defining uses) - rust-lang/rust#146272 (Update comment for `-Werror` on LLVM builds) - rust-lang/rust#146280 (Make `LetChainsPolicy` public for rustfmt usage) r? `@ghost` `@rustbot` modify labels: rollup
single buffer for exponent fmt of integers No need for fragmented buffers when formatting. ``` orig.txt: fmt::write_i128_exp 143.39ns/iter +/- 0.32 orig.txt: fmt::write_i64_exp 68.72ns/iter +/- 0.03 new.txt: fmt::write_i128_exp 138.29ns/iter +/- 0.50 new.txt: fmt::write_i64_exp 58.93ns/iter +/- 4.62 ``` This patch fully eliminates unsafe pointer use (after rust-lang#135265 and rust-lang#136594). r? libs
No need for fragmented buffers when formatting.
This patch fully eliminates unsafe pointer use (after #135265 and #136594).