Permalink
Please
sign in to comment.
Browse files
Use `fold` to implement `Iterator::for_each`
The benefit of using internal iteration is shown in new benchmarks:
test iter::bench_for_each_chain_fold ... bench: 635,110 ns/iter (+/- 5,135)
test iter::bench_for_each_chain_loop ... bench: 2,249,983 ns/iter (+/- 42,001)
test iter::bench_for_each_chain_ref_fold ... bench: 2,248,061 ns/iter (+/- 51,940)- Loading branch information...
Showing
with
51 additions
and 4 deletions.
- +47 −0 src/libcore/benches/iter.rs
- +4 −4 src/libcore/iter/iterator.rs
0 comments on commit
4a8ddac