-
Notifications
You must be signed in to change notification settings - Fork 14k
Experiment: New fmt::Arguments implementation (another one) #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
base: main
Are you sure you want to change the base?
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)
|
The job Click to see the possible cause of the failure (guessed by this bot)For more information how to resolve CI failures of this job, visit this link. |
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
|

Part of #99012
Alternative to #148529
This is yet another an experimental new implementation of
fmt::Arguments. In this implementation,fmt::Argumentsis only two pointers in size. (Instead of six, currently.) This makes it the same size as a&strand makes it fit in a register pair.Unlike #148529, 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.Like #148529, 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:Similarly,
panic!("Hello, world!");shows the same change.To do: