Skip to content

Commit

Permalink
[DO NOT MERGE] Experiment with removing unrolling from slice::Iter::t…
Browse files Browse the repository at this point in the history
…ry_fold
  • Loading branch information
scottmcm committed Sep 19, 2019
1 parent eceec57 commit 38d8c8d
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 38d8c8d

Please sign in to comment.