-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
VecDeque::partition_point
and binary_search_by
check first element in back
slice only once
#136159
base: master
Are you sure you want to change the base?
VecDeque::partition_point
and binary_search_by
check first element in back
slice only once
#136159
Conversation
… once I noticed that the first element of the `back` slice is potentially checked twice for the `partition_point` method, first in an if-condition and second inside the respective body. In this change, the back slice is reduced by the first element and this offset is added to the result. I am not sure how to trigger benchmarks for this, I assume doing this PR is the way to go for bors. Please tell me if this is not how pull requests should be done.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ibraheemdev (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
…on-point-optimization, r=<try> `VecDeque::partition_point` checks first element in `back` slice only once I noticed that the first element of the back slice is potentially checked twice for the partition_point method, first in an if-condition and second inside the respective body. In this change, the back slice is reduced by the first element and this offset is added to the result. I am not sure how to trigger benchmarks for this, I assume doing this PR is the way to go for Bors. Please tell me if this is not how pull requests should be done.
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…on-point-optimization, r=<try> `VecDeque::partition_point` checks first element in `back` slice only once I noticed that the first element of the back slice is potentially checked twice for the partition_point method, first in an if-condition and second inside the respective body. In this change, the back slice is reduced by the first element and this offset is added to the result. I am not sure how to trigger benchmarks for this, I assume doing this PR is the way to go for Bors. Please tell me if this is not how pull requests should be done.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (7ec1805): comparison URL. Overall result: ✅ improvements - 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 is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -0.7%, secondary 1.1%)This 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: 772.605s -> 770.21s (-0.31%) |
This seems to look good. I noticed the same thing can be done to |
VecDeque::partition_point
checks first element in back
slice only onceVecDeque::partition_point
and binary_search_by
check first element in back
slice only once
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
@urben1680: 🔑 Insufficient privileges: not in try users |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…on-point-optimization, r=<try> `VecDeque::partition_point` and `binary_search_by` check first element in `back` slice only once I noticed that the first element of the back slice is potentially checked twice for the partition_point method, first in an if-condition and second inside the respective body. EDIT: Applied the same change to `binary_search_by` method. In this change, the back slice is reduced by the first element and this offset is added to the result. I am not sure how to trigger benchmarks for this, I assume doing this PR is the way to go for Bors. Please tell me if this is not how pull requests should be done.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (902ee03): 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)This benchmark run did not return any relevant results for this metric. 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: 777.277s -> 779.692s (0.31%) |
So it looks like |
I noticed that the first element of the back slice is potentially checked twice for the partition_point method, first in an if-condition and second inside the respective body.
EDIT: Applied the same change to
binary_search_by
method.In this change, the back slice is reduced by the first element and this offset is added to the result.
I am not sure how to trigger benchmarks for this, I assume doing this PR is the way to go for Bors.
Please tell me if this is not how pull requests should be done.