-
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 |
|
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
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. |
|
Queued 6e6ba94 with parent a7b3715, future comparison URL. |
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: