-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Turn may_have_side_effect into an associated constant #82043
Conversation
r? @kennytm (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 cdf4aeedf8e17f135d5eb47c93216494e697b76a with merge 24e0ffc40ec8010079c7918ebf7977e9df4b06b0... |
☀️ Try build successful - checks-actions |
Queued 24e0ffc40ec8010079c7918ebf7977e9df4b06b0 with parent 3f5aee2, future comparison URL. |
Finished benchmarking try commit (24e0ffc40ec8010079c7918ebf7977e9df4b06b0): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
The `may_have_side_effect` is an implementation detail of `TrustedRandomAccess` trait. It describes if obtaining an iterator element may have side effects. It is currently implemented as an associated function. Turn `may_have_side_effect` into an associated constant. This makes the value immediately available to the optimizer.
cdf4aee
to
dc3304c
Compare
seems no much change in the compiler's instruction count on average? |
@kennytm do you need some further input or motivation behind those changes? The current implementation relies on inter procedural optimizations to determine that Implementing this as an associated constant avoids such problems altogether. The future of |
@tmiasko Looks fine to me but since you invoked perf i'm just awaiting for analysis if this matches your expectation 😅. |
I didn't expect any significant impact on perf benchmarks. The perf run was just in case something unanticipated happened like with |
okay. @bors r+ |
📌 Commit dc3304c has been approved by |
⌛ Testing commit dc3304c with merge 14de747478bb9ca170736a138a1adb94b00ad328... |
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
☀️ Test successful - checks-actions |
The
may_have_side_effect
is an implementation detail ofTrustedRandomAccess
trait. It describes if obtaining an iterator element may have side effects. It
is currently implemented as an associated function.
Turn
may_have_side_effect
into an associated constant. This makes thevalue immediately available to the optimizer.