According to the results of vs_vec.rs bench, we are slower in iterating than Vec:
$ rustup run nightly cargo bench
...
Running benches/vs_vec.rs (target/release/deps/vs_vec-903d5e84934e313a)
running 2 tests
test stack_push_and_pop ... bench: 6,058 ns/iter (+/- 449)
test vec_push_and_pop ... bench: 3,425 ns/iter (+/- 138)
The problem is in the into_iter() method. Let's figure out where is the lag and fix.
According to the results of
vs_vec.rsbench, we are slower in iterating thanVec:The problem is in the
into_iter()method. Let's figure out where is the lag and fix.