-
Notifications
You must be signed in to change notification settings - Fork 14k
New format_args!() and fmt::Arguments implementation #148789
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
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Experiment: New fmt::Arguments implementation (another one)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (6e6ba94): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -1.5%, secondary -0.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -0.5%, secondary -4.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.7%, secondary -1.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 476.631s -> 471.922s (-0.99%) |
|
Ooh that's pretty good :D |
|
Pretty much everything looks like a great improvement. Not only number of instructions executed, but also memory usage and binary size. 🎉 Only two significant negative results: 1. "image-0.25.6 opt incr-patched:println" with almost +6% instructions:u.Looking at the detailed results, it looks like that's all LLVM. Probably because llvm got more optimization opportunities. That's not necessarily a bad thing. 2. The
|
9f41692 to
349d2b5
Compare
349d2b5 to
5b58c66
Compare
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Experiment: New fmt::Arguments implementation (another one)
This comment has been minimized.
This comment has been minimized.
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.
all my nits are pretty minor, so r=me with or without them
|
also looked it over, r=me,wafflelapkin after nits |
|
@bors r=wafflelapkin,jdonszelmann rollup=never |
|
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 0186755 (parent) -> 503dce3 (this PR) Test differencesShow 202 test diffs202 doctest diffs were found. These are ignored, as they are noisy. Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 503dce33e2e2a5d2fe978b2723ab2a994cc27472 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (503dce3): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowOur benchmarks found a performance regression caused by this PR. Next Steps:
@rustbot label: +perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -1.5%, secondary -1.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.3%, secondary 0.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.8%, secondary -1.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 476.356s -> 473.309s (-0.64%) |

Part of #99012
This is a new implementation of
format_args!()andfmt::Arguments. With this implementation,fmt::Argumentsis only two pointers in size. (Instead of six, before.) This makes it the same size as a&strand makes it fit in a register pair.This
fmt::Argumentscan store a&'static strwithout any indirection or additional storage. This means that simple cases likeprint_fmt(format_args!("hello"))are now just as efficient for the caller asprint_str("hello"), as shown by this example:(
panic!("Hello, world!");shows a similar change.)This implementation stores all static information as just a single (byte) string, without any indirection:
This saves a ton of pointers and simplifies the expansion significantly, but does mean that individual pieces (e.g.
"Hello, "and"!\n") cannot be reused. (Those pieces are often smaller than a pointer to them, though, in which case reusing them is useless.)The details of the new representation are documented in library/core/src/fmt/mod.rs.