mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 01:13:11 +00:00
![]() Change branching in `iter.skip()` Optimize branching in `Skip`, which was brought up in #80416. This assumes that if `next` is called, it's likely that there will be more calls to `next`, and the branch for skip will only be hit once thus it's unlikely to take that path. Even w/o the `unlikely` intrinsic, it compiles more efficiently, I believe because the path where `next` is called is always taken. It should be noted there are very few places in the compiler where `Skip` is used, so probably won't have a noticeable perf impact. [New impl](https://godbolt.org/z/85rdj4) [Old impl](https://godbolt.org/z/Wc74rh) [Some additional asm examples](https://godbolt.org/z/feKzoz) although they really don't have a ton of difference between them. |
||
---|---|---|
.. | ||
alloc | ||
backtrace@af078ecc0b | ||
core | ||
panic_abort | ||
panic_unwind | ||
proc_macro | ||
profiler_builtins | ||
rtstartup | ||
rustc-std-workspace-alloc | ||
rustc-std-workspace-core | ||
rustc-std-workspace-std | ||
std | ||
stdarch@9c732a56f6 | ||
term | ||
test | ||
unwind |