library: optimize truncate method#157123
Conversation
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
@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.
library: optimize truncate method
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (0b2c3b8): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)This perf run didn't have relevant results for this metric. CyclesResults (primary 2.3%, secondary 2.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.0%, secondary -0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 511.654s -> 511.381s (-0.05%) |
|
The same, slightly improved assembly is generated if you remove or equal from the original condition. I.e. turn |
You’re correct that changing |
Closes #76089
Slightly better code when the elements have drop glue, see #74172 (comment).
Slightly worse code for
truncate(0), see #78884 (comment). However, this is mitigated by the newclippy::manual_clearlint which is warn-by-default.