1
Fork 0
rust/library/core/src
bors 4153fa82ff 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.
2021-01-23 09:25:11 +00:00
..
alloc Auto merge of #79827 - tmiasko:size-align, r=kennytm 2021-01-03 03:43:29 +00:00
array Add [T; N]::each_ref and [T; N]::each_mut 2021-01-11 01:09:22 -08:00
char Rollup merge of #79502 - Julian-Wollersberger:from_char_for_u64, r=withoutboats 2021-01-10 16:55:53 +09:00
convert Deprecate-in-future the constants superceded by RFC 2700 2021-01-20 20:08:11 -05:00
fmt Rollup merge of #80991 - calebsander:fix/fmt-link, r=m-ou-se 2021-01-14 18:00:31 +00:00
future Use more std:: instead of core:: in docs for consistency, add more intra doc links 2020-12-02 00:41:53 +01:00
hash fix aliasing issues in SipHasher 2020-10-31 16:26:06 +01:00
iter Auto merge of #80715 - JulianKnodt:skip_opt, r=nagisa 2021-01-23 09:25:11 +00:00
macros Fix formatting specifiers doc link 2021-01-13 15:05:39 -05:00
mem Rollup merge of #80600 - CoffeeBlend:maybe_uninit_array_assume_init, r=dtolnay 2021-01-12 16:13:24 +09:00
num Deprecate-in-future the constants superceded by RFC 2700 2021-01-20 20:08:11 -05:00
ops Add as_ref and as_mut methods for Bound 2021-01-13 21:16:26 -05:00
prelude mv std libs to library/ 2020-07-27 19:51:13 -05:00
ptr Rollup merge of #81168 - soniasingla:doc/sonia, r=jonas-schievink 2021-01-19 10:28:04 +01:00
slice use raw-ptr-addr-of for slice::swap 2021-01-18 11:24:48 +01:00
str Auto merge of #77858 - ijackson:split-inclusive, r=KodrAus 2021-01-13 07:38:58 +00:00
sync Rollup merge of #80966 - KodrAus:deprecate/spin_loop_hint, r=m-ou-se 2021-01-14 18:00:14 +00:00
task stabilize the poll_map feature 2021-01-13 14:51:27 +10:00
unicode Privatize some of libcore unicode_internals 2020-12-07 16:16:42 +03:00
any.rs Apply suggestions from code review 2020-12-09 23:13:24 +00:00
ascii.rs Fixed some intra-docs links in library/core 2020-09-18 07:49:29 +08:00
bool.rs Stabilise then 2020-11-22 13:45:14 +00:00
borrow.rs Remove many unnecessary manual link resolves from library 2020-12-31 11:54:32 -08:00
cell.rs add tracking issue to cell_filter_map 2021-01-16 10:40:36 +10:00
clone.rs Improve readability 2020-09-01 19:56:32 +02:00
cmp.rs Update cmp.rs 2021-01-17 16:11:48 +01:00
default.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
ffi.rs Properly define va_arg and va_list for aarch64-apple-darwin 2020-10-25 21:37:01 -04:00
hint.rs Fixed documentation error 2021-01-03 19:54:54 +02:00
internal_macros.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
intrinsics.rs Only inherit const stability for methods of impl const Trait blocks 2021-01-18 11:07:35 +00:00
lazy.rs Capitalize safety comments 2020-09-08 22:26:44 -04:00
lib.rs use raw-ptr-addr-of for slice::swap 2021-01-18 11:24:48 +01:00
marker.rs Auto merge of #77893 - petertodd:2020-impl-default-for-phantompinned, r=dtolnay 2020-11-23 07:00:30 +00:00
option.rs Remove many unnecessary manual link resolves from library 2020-12-31 11:54:32 -08:00
panic.rs Use more std:: instead of core:: in docs for consistency, add more intra doc links 2020-12-02 00:41:53 +01:00
panicking.rs Bump bootstrap compiler version 2020-11-19 19:23:36 -05:00
pin.rs Remove many unnecessary manual link resolves from library 2020-12-31 11:54:32 -08:00
primitive.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
raw.rs Use intra-doc-links in core::{raw, ffi, pin} 2020-08-22 22:25:27 +02:00
result.rs Remove many unnecessary manual link resolves from library 2020-12-31 11:54:32 -08:00
time.rs Remove Duration::MIN entirely 2020-10-27 15:48:58 -07:00
tuple.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
unit.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00