Uh oh!
There was an error while loading. Please reload this page.
add slice::swap_unchecked - #88540
Conversation
rust-highfive
commented
Aug 31, 2021
r? @kennytm (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cf9694a to
bc999caCompareleonardo-m
commented
Aug 31, 2021
See #71874 |
leonardo-m
commented
Aug 31, 2021
I think it's worth using this inside slice::reverse. |
Uh oh!
There was an error while loading. Please reload this page.
camelid
commented
Oct 8, 2021
triage: @ibraheemdev could you address the above comments? Thanks! |
774b8d3 to
c517a0dCompareUh oh!
There was an error while loading. Please reload this page.
kennytm
commented
Oct 14, 2021
@bors r+ |
bors
commented
Oct 14, 2021
📌 Commit cf12732 has been approved by |
Uh oh!
There was an error while loading. Please reload this page.
add `slice::swap_unchecked` An unsafe version of `slice::swap` that does not do bounds checking.
matthiaskrgr
commented
Oct 15, 2021
@bors rollup=never likely has some perf effects |
bors
commented
Oct 15, 2021
bors
commented
Oct 15, 2021
☀️ Test successful - checks-actions |
rust-timer
commented
Oct 15, 2021
Finished benchmarking commit (1dafe6d): comparison url. Summary: This change led to small relevant regressions 😿 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression |
kennytm
commented
Oct 15, 2021
maybe revert the implementation of the safe |
rylev
commented
Oct 19, 2021
@kennytm@ibraheemdev this seems to have landed with more bounds checking than is necessary though I would imagine that the extra checking shouldn't be happening in the compiler since debug assertions are off. While the regressions aren't huge, they are in real world crates and this is likely to effect the perf of many (most?) Rust programs in a negative way. Perhaps we should do the suggestion of reverting the implementation of the safe Also FYI, when it's likely that a perf regression could come out of a change (as was pointed out) it's best to just run a perf run before merging. |
IIRC, I'm also surprised that there's a regression; like you said, I thought the compiler was by default built with debug assertions turned off. Maybe the bounds checks are not the source of the regression? |
Revert implementation of `slice::swap` Due to the perf regressions noticed here, possible due to inlining? rust-lang#88540 (comment) r? `@kennytm`
Revert implementation of `slice::swap` Due to the perf regressions noticed here, possible due to inlining? rust-lang/rust#88540 (comment) r? `@kennytm`
An unsafe version of
slice::swapthat does not do bounds checking.