Profiling reveals that using step_by() surprisingly has a performance impact:
That's counter intuitive, but this might be due to https://doc.rust-lang.org/src/core/iter/adapters/step_by.rs.html being a complicated way of doing something that we really want to be simple.
Falling back to the simplest possible code, we get the following profile:
which does not have the perf bug.
comparison of runtimes:
before:
real 0m20.214s
user 0m19.246s
sys 0m0.666s
Profiling reveals that using
step_by()
surprisingly has a performance impact: That's counter intuitive, but this might be due to https://doc.rust-lang.org/src/core/iter/adapters/step_by.rs.html being a complicated way of doing something that we really want to be simple.Falling back to the simplest possible code, we get the following profile: which does not have the perf bug.
comparison of runtimes:
before: real 0m20.214s user 0m19.246s sys 0m0.666s
after: real 0m15.429s user 0m14.782s sys 0m0.611s