-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Removed redundant bounds checking at Split's next and next_back methods #119285
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @joshtriplett (or someone else) soon. 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 (
|
This comment has been minimized.
This comment has been minimized.
The optimizer is often able to eliminate bounds checks based on value range information. Have you checked the assembly whether this makes any difference? |
Well, I guess sometimes it fails to eliminate bound checks. I was compiling my project which uses Split with: |
Might affect perf. @bors r+ rollup=never |
☀️ Test successful - checks-actions |
Finished benchmarking commit (f645628): 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.
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 sizeResultsThis 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.
Bootstrap: 671.757s -> 671.254s (-0.07%) |
Since these methods are using
Iterator::rposition
, which always returns a valid index, then there is no point in regular indexing with bounds checking