rust/src/libcore/ops
Mazdak Farrokhzad f19bec89d7
Rollup merge of #58122 - matthieu-m:range_incl_perf, r=dtolnay
RangeInclusive internal iteration performance improvement.

Specialize `Iterator::try_fold` and `DoubleEndedIterator::try_rfold` to improve code generation in all internal iteration scenarios.

This changes brings the performance of internal iteration with `RangeInclusive` on par with the performance of iteration with `Range`:

 - Single conditional jump in hot loop,
 - Unrolling and vectorization,
 - And even Closed Form substitution.

Unfortunately, it only applies to internal iteration. Despite various attempts at stream-lining the implementation of `next` and `next_back`, LLVM has stubbornly refused to optimize external iteration appropriately, leaving me with a choice between:

 - The current implementation, for which Closed Form substitution is performed, but which uses 2 conditional jumps in the hot loop when optimization fail.
 - An implementation using a `is_done` boolean, which uses 1 conditional jump in the hot loop when optimization fail, allowing unrolling and vectorization, but for which Closed Form substitution fails.

In the absence of any conclusive evidence as to which usecase matters most, and with no assurance that the lack of Closed Form substitution is not indicative of other optimizations being foiled, there is no way
to pick one implementation over the other, and thus I defer to the statu quo as far as `next` and `next_back` are concerned.
2019-02-23 09:25:12 +01:00
..
arith.rs libs: doc comments 2019-02-10 23:57:25 +00:00
bit.rs Remove licenses 2018-12-25 21:08:33 -07:00
deref.rs Auto merge of #57765 - Mark-Simulacrum:bootstrap-bump, r=alexcrichton 2019-01-27 18:18:17 +00:00
drop.rs Fix broken links to second edition TRPL. 2019-01-01 12:53:07 -05:00
function.rs Add #[must_use] message to Fn* traits 2019-02-07 19:44:06 +09:00
generator.rs Change generator trait to use pinning 2019-01-27 22:58:53 +01:00
index.rs Make str indexing generic on SliceIndex. 2019-01-19 04:16:05 -05:00
mod.rs Remove licenses 2018-12-25 21:08:33 -07:00
range.rs Rollup merge of #58122 - matthieu-m:range_incl_perf, r=dtolnay 2019-02-23 09:25:12 +01:00
try.rs tests: doc comments 2019-02-10 23:42:32 +00:00
unsize.rs Remove licenses 2018-12-25 21:08:33 -07:00