-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Mark String::clone
as inline-able
#88916
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
Mark String::clone
as inline-able
#88916
Conversation
It calls `Vec::clone` and performs a newtype-wrap around it, so it should be trivial enough that it doesn't cause major size regressions. It also fixes rust-lang#88905
r? @dtolnay (rust-highfive has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit e32f90c with merge 4997354d85d9c0ea35ae9df9300fa1db9de4997b... |
☀️ Try build successful - checks-actions |
Queued 4997354d85d9c0ea35ae9df9300fa1db9de4997b with parent 9bb77da, future comparison URL. |
Finished benchmarking commit (4997354d85d9c0ea35ae9df9300fa1db9de4997b): comparison url. Summary: This change led to moderate relevant mixed results 🤷 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never |
Hmm, seems like the results are quite mixed. It could be worth doing another perf run to see if the results are spurious, but I'll let T-libs decide. |
Note that LTO does inline this, it'll only benefit non-LTO builds. |
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.
I am not convinced that it is worth making this change. Is there a common idiom that leads to strings getting cloned and never used? If this is minimized from real world code then we can evaluate vs the costs of inline, but I am having trouble seeing how this would come up in a hot path in practice.
It calls
Vec::clone
and performs a newtype-wrap around it, so it should be trivial enough that it doesn't cause major size regressions. It also fixes #88905