Uh oh!
There was an error while loading. Please reload this page.
internal iteration for &mut I - #100173
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
rust-highfive
commented
Aug 5, 2022
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @scottmcm (or someone else) soon. Please see the contribution instructions for more information. |
scottmcm
commented
Aug 5, 2022
@bors try @rust-timer queue |
rust-timer
commented
Aug 5, 2022
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
bors
commented
Aug 5, 2022
⌛ Trying commit cb7f7ee with merge 3e685715a7ece536b2ab653e3433c06c00454bdf... |
| impl<'a, I: DoubleEndedIterator + Sized> ByRefRFold for &'a mut I { | ||
| #[inline] | ||
| default fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R |
There was a problem hiding this comment.
The more specific impl shouldn't have default
bors
commented
Aug 5, 2022
☀️ Try build successful - checks-actions |
rust-timer
commented
Aug 5, 2022
Queued 3e685715a7ece536b2ab653e3433c06c00454bdf with parent d77da9d, future comparison URL. |
rust-timer
commented
Aug 5, 2022
Finished benchmarking commit (3e685715a7ece536b2ab653e3433c06c00454bdf): comparison url. Instruction count
Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Footnotes |
scottmcm
commented
Aug 5, 2022
sarah-quinones
commented
Aug 5, 2022
well, these don't look like the most promising results ^^' |
compiler-errors
commented
Aug 6, 2022
Presumably this makes compilation slower, but the perf tests don't show the effect on the performance of the compiled code, right? |
sarah-quinones
commented
Aug 6, 2022
are there tests that do? |
the8472
commented
Aug 6, 2022
Other than the std benches (which aren't great) we don't have anything automated to assess runtime performance. In the rustc-perf suite check and doc builds are the closest since they don't codegen but they're probably not diverse enough. You could try paring down the PR by splitting out some of the changes. E.g. some of the inlining in function.rs doesn't look relevant to iterators. You can also run rustc-perf locally and focus on that one benchmark, that should yield results more quickly (assuming you have a machine that can compile a stage1 rustc in a reasonable amount of time). |
sarah-quinones
commented
Aug 6, 2022
rustc-perf seems to take forever on my machine and i can't display the results after it's finished. so that doesn't seem like a good option for me :/ |
the8472
commented
Aug 6, 2022
It can be set to run a subset of the benchmarks, e.g. the serde ones. https://github.com/rust-lang/rustc-perf/tree/master/collector#benchmarking-options |
sarah-quinones
commented
Aug 6, 2022
thanks for the tips! i managed to get it working thanks to your help. it seems that the biggest culprit was inlining the ops::function wrappers. |
scottmcm
commented
Aug 11, 2022
I'm going to send this over to r? @m-ou-se because I think this is going to be as much a policy decision (about compile-vs-runtime) as it is about the code itself. |
the8472
commented
Aug 11, 2022
Some changes were reverted, let's get new perf results. @bors try @rust-timer queue |
rust-timer
commented
Aug 11, 2022
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
bors
commented
Aug 11, 2022
⌛ Trying commit f6a3462 with merge c20ee6d211784a78b94e26d37cce4e66acea976a... |
bors
commented
Aug 11, 2022
☀️ Try build successful - checks-actions |
rust-timer
commented
Aug 11, 2022
Queued c20ee6d211784a78b94e26d37cce4e66acea976a with parent aeb5067, future comparison URL. |
rust-timer
commented
Aug 11, 2022
Finished benchmarking commit (c20ee6d211784a78b94e26d37cce4e66acea976a): comparison url. Instruction count
Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Footnotes |
m-ou-se
commented
Dec 30, 2022
r? @the8472 |
the8472
commented
Dec 30, 2022
The compile-time perf numbers are slightly negative, but less so than the previous attempt to do this. But we need some runtime benchmark numbers to verify that it brings the expected benefits. There are some core::iter benchmarks that I'd expect to show some speedup. @rustbot author |
Dylan-DPC
commented
Jan 23, 2023
@sarah-ek any updates on this? |
Dylan-DPC
commented
May 16, 2023
Closing this as inactive. Feel free to reöpen this pr or create a new pr if you get the time to work on this. Thanks |

this pr implements internal iteration for
&mut IwhenI: Sized. it additionally inlines some wrapper functions that were not previously inline, which seems to speed things up by a fair amount in some cases.this lead to up to 3x performance gains across the board for
iter::benches, with only a minor regression foriter::bench_filter_sum