Usually avoid the sort in WrappingRange::smallest_range_containing - #160674
Usually avoid the sort in WrappingRange::smallest_range_containing#160674scottmcm wants to merge 1 commit into
WrappingRange::smallest_range_containing#160674Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Usually avoid the sort in `WrappingRange::smallest_range_containing`
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (d0d0b8b): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 1.1%, secondary -0.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -0.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 460.09s -> 458.727s (-0.30%) |
|
r? @folkertdev rustbot has assigned @folkertdev. Use Why was this reviewer chosen?The reviewer was selected based on:
|
I wasn't planning on touching this again, but I had a shower thought: we've been sorting these for a while because that's better than doing a quadratic check for usable wraparound ranges, but actually we often don't need to.
So long as the obvious
min..=maxrange is small enough, we don't need to bother even looking for a wrapping range!Now, I don't think this code is particularly hot -- you'd need lots of enums or particularly big ones before it would really matter -- but this does let us short-circuit for even fairly complex enums like mem::alignment.