Skip to content

Commit

Permalink
Auto merge of #64600 - scottmcm:no-slice-tryfold-unroll, r=<try>
Browse files Browse the repository at this point in the history
[DO NOT MERGE] Experiment with removing unrolling from slice::Iter::try_fold

For context see #64572 (comment)

r? @scottmcm
  • Loading branch information
bors committed Sep 19, 2019
2 parents eceec57 + 38d8c8d commit dd115ba
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3187,12 +3187,13 @@ macro_rules! iterator {
// manual unrolling is needed when there are conditional exits from the loop
let mut accum = init;
unsafe {
while len!(self) >= 4 {
accum = f(accum, next_unchecked!(self))?;
accum = f(accum, next_unchecked!(self))?;
accum = f(accum, next_unchecked!(self))?;
accum = f(accum, next_unchecked!(self))?;
}
// REMOVED AS AN EXPERIMENT; DO NOT MERGE
// while len!(self) >= 4 {
// accum = f(accum, next_unchecked!(self))?;
// accum = f(accum, next_unchecked!(self))?;
// accum = f(accum, next_unchecked!(self))?;
// accum = f(accum, next_unchecked!(self))?;
// }
while !is_empty!(self) {
accum = f(accum, next_unchecked!(self))?;
}
Expand Down

0 comments on commit dd115ba

Please sign in to comment.