-
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
[rustc_data_structures] Use partition_point to find slice range end. #114231
Conversation
…ce end.
r? @TaKO8Ki (rustbot has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 9ced089 with merge cdca3430dc0d29742e4cff0188d837a46e9a1f3d... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (cdca3430dc0d29742e4cff0188d837a46e9a1f3d): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDBenchmarking 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 may lead 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 Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 652.574s -> 650.842s (-0.27%) |
This pull request seems to have regressions. Do you have any ideas to improve this? @ttsugriy |
@TaKO8Ki , are you sure these regression numbers legit? Even if this PR had a regression, which I doubt, the magnitude seems very unlikely. Is there a way to rerun these benchmarks? |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 9ced089 with merge 539a718a86697c85050b140cfd17d0b168c1162d... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (539a718a86697c85050b140cfd17d0b168c1162d): comparison URL. Overall result: no relevant changes - no action neededBenchmarking 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 may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 649.854s -> 651.21s (0.21%) |
Thanks for rerunning the tests, @TaKO8Ki ! As you can see, as expected, the "regression" was just a measurement noise :) |
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.
One nit wrt comments. r=me afterwards.
@ttsugriy any updates on this? |
@Dylan-DPC I don't see any comments below mine, so I guess there are no updates |
@Dylan-DPC the review comment didn't request any changes - it simply questioned the value of explicit invariants. I think that plain text comments are much less useful than invariants so I didn't consider that comment as a call for action. Since I no longer use Rust, I don't mind removing these useful invariants, so they are now gone. |
☀️ Test successful - checks-actions |
Finished benchmarking commit (25f8d01): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 665.206s -> 666.403s (0.18%) |
This PR uses approach introduced in #114152 to find
the end of the range. It's much easier to understand and reason about invariants of such
implementation.
Technically it's possible to make it even shorter by returning
&[start..end]
unconditionallybecause even if searched item is not present in the slice,
start
andend
would point atthe same index, so the range would be empty. The reason I decided not to use this shorter
implementation is because it would involve more comparisons in case there are no elements
in the slice with key equal to
key
.Also, not that it matters much, but this implementation also improves perf according to the
benchmark below:
https://gist.github.com/ttsugriy/63c0ed39ae132b131931fa1f8a3dea55
The results on my M1 macbook air are: