diff options
Diffstat (limited to 'benches')
-rw-r--r-- | benches/bench.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/benches/bench.rs b/benches/bench.rs index 7a3c07e..ad73226 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -159,12 +159,11 @@ fn gen_insert<V: Vector<u64>>(n: u64, b: &mut Bencher) { b.iter(|| { let mut vec = V::new(); - // Add one element, with each iteration we insert one before the end. - // This means that we benchmark the insertion operation and not the - // time it takes to `ptr::copy` the data. + // Always insert at position 0 so that we are subject to shifts of + // many different lengths. vec.push(0); for x in 0..n { - insert_noinline(&mut vec, x as _, x); + insert_noinline(&mut vec, 0, x); } vec }); @@ -179,8 +178,8 @@ fn gen_remove<V: Vector<u64>>(n: usize, b: &mut Bencher) { b.iter(|| { let mut vec = V::from_elem(0, n as _); - for x in (0..n - 1).rev() { - remove_noinline(&mut vec, x); + for _ in 0..n { + remove_noinline(&mut vec, 0); } }); } |