diff options
| author | bors <bors@rust-lang.org> | 2021-01-23 09:25:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-01-23 09:25:11 +0000 |
| commit | 4153fa82ff8403bde877b52d35bf1ef99e54a4a2 (patch) | |
| tree | 3aa8af47a3752a6945cea30ac28876a1257f172a /compiler/rustc | |
| parent | 1986b58c646a9523d0a8a0fa8a0bd20492e7795d (diff) | |
| parent | e5094a28514f25654f9096601bd1df75657f16ba (diff) | |
| download | rust-4153fa82ff8403bde877b52d35bf1ef99e54a4a2.tar.gz rust-4153fa82ff8403bde877b52d35bf1ef99e54a4a2.zip | |
Auto merge of #80715 - JulianKnodt:skip_opt, r=nagisa
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.
Diffstat (limited to 'compiler/rustc')
0 files changed, 0 insertions, 0 deletions
