Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand All @@ -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);
}
});
}
Expand Down