lib: specialize Clone of array IntoIter#156634
Conversation
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
1ef1a4b to
5cec957
Compare
|
@bors r+ Great, thanks! |
…clone, r=joboet lib: specialize Clone of array IntoIter This PR adds the `TrivialClone` specialization to the `PolymorphicIter` type, which `array::IntoIter` uses. I also added another coretest for the default case (already existing test catches the specialized one). There are no unwinding concerns since `TrivialClone` means cloning = copying and we never call `Clone::clone`. `array:IntoIter` is being used on a lot of places in both `core` and in user code, and `array::IntoIter` (nor does its users) override `Clone` often and just delegate to the inner type `PolymorphicIter` which does not yet do the `TrivialClone` specialization and is burdened by the iterator and unwind safety shenanigans for all types, so this PR should address some of that. This should in turn slightly reduce both stack usage and remove unwinding prologue/epilogue etc. from such functions and improve our `-Cno-prepopulate-passes` codegen too. perf: https://godbolt.org/z/eTPjj3hP3
…clone, r=joboet lib: specialize Clone of array IntoIter This PR adds the `TrivialClone` specialization to the `PolymorphicIter` type, which `array::IntoIter` uses. I also added another coretest for the default case (already existing test catches the specialized one). There are no unwinding concerns since `TrivialClone` means cloning = copying and we never call `Clone::clone`. `array:IntoIter` is being used on a lot of places in both `core` and in user code, and `array::IntoIter` (nor does its users) override `Clone` often and just delegate to the inner type `PolymorphicIter` which does not yet do the `TrivialClone` specialization and is burdened by the iterator and unwind safety shenanigans for all types, so this PR should address some of that. This should in turn slightly reduce both stack usage and remove unwinding prologue/epilogue etc. from such functions and improve our `-Cno-prepopulate-passes` codegen too. perf: https://godbolt.org/z/eTPjj3hP3
…uwer Rollup of 5 pull requests Successful merges: - #153957 (Add bootstrap step for stdarch-verify) - #156634 (lib: specialize Clone of array IntoIter) - #157050 (Couple of changes to help with moving LTO to the link phase) - #156931 (Add splitting caveats to `{read,write}_volatile`) - #157071 (Fix `cfg` typo in rustdoc book)
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing cced03b (parent) -> dc375db (this PR) Test differencesShow 4 test diffsStage 1
Stage 2
Additionally, 2 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard dc375db7d8df0aa450e622c529147c95eee756f5 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (dc375db): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression 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 5.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis perf run didn't have relevant results for this metric. Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 511.528s -> 510.27s (-0.25%) |
This PR adds the
TrivialClonespecialization to thePolymorphicItertype, whicharray::IntoIteruses. I also added another coretest for the default case (already existing test catches the specialized one).There are no unwinding concerns since
TrivialClonemeans cloning = copying and we never callClone::clone.array:IntoIteris being used on a lot of places in bothcoreand in user code, andarray::IntoIter(nor does its users) overrideCloneoften and just delegate to the inner typePolymorphicIterwhich does not yet do theTrivialClonespecialization and is burdened by the iterator and unwind safety shenanigans for all types, so this PR should address some of that. This should in turn slightly reduce both stack usage and remove unwinding prologue/epilogue etc. from such functions and improve our-Cno-prepopulate-passescodegen too.perf: https://godbolt.org/z/eTPjj3hP3