-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Introduce RawVec::reserve_for_push
.
#91352
Conversation
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 0b2cf79825ef392a8afb6f97c4520ed96d839f9b with merge 7ab15d61caf7de62a33d9209692eefb792143ae8... |
☀️ Try build successful - checks-actions |
Queued 7ab15d61caf7de62a33d9209692eefb792143ae8 with parent 44723c5, future comparison URL. |
Finished benchmarking commit (7ab15d61caf7de62a33d9209692eefb792143ae8): comparison url. Summary: This change led to large 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 |
Perf results look good, and the instruction count improvements are mostly among the real-world benchmarks, which is nice. r? @dtolnay |
If `Vec::push`'s capacity check fails it calls `RawVec::reserve`, which then also does a capacity check. This commit introduces `reserve_for_push` which skips the redundant capacity check, for some slight compile time speed-ups. I tried lots of minor variations on this, e.g. different inlining attributes. This was the best one I could find.
0b2cf79
to
6a83352
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.
Awesome!
@bors r+ |
📌 Commit 6a83352 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (207c80f): comparison url. Summary: This change led to large relevant mixed results 🤷 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression |
@rustbot label: +perf-regression-triaged Because (a) the instruction counts improvement significantly outweigh the regressions in size, and (b) the improvements are all in real-world benchmarks, while the regressions are mostly in artificial benchmarks. |
If
Vec::push
's capacity check fails it callsRawVec::reserve
, whichthen also does a capacity check.
This commit introduces
reserve_for_push
which skips the redundantcapacity check, for some slight compile time speed-ups.
I tried lots of minor variations on this, e.g. different inlining
attributes. This was the best one I could find.
r? @ghost