File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -159,12 +159,11 @@ fn gen_insert<V: Vector<u64>>(n: u64, b: &mut Bencher) {
159
159
160
160
b. iter ( || {
161
161
let mut vec = V :: new ( ) ;
162
- // Add one element, with each iteration we insert one before the end.
163
- // This means that we benchmark the insertion operation and not the
164
- // time it takes to `ptr::copy` the data.
162
+ // Always insert at position 0 so that we are subject to shifts of
163
+ // many different lengths.
165
164
vec. push ( 0 ) ;
166
165
for x in 0 ..n {
167
- insert_noinline ( & mut vec, x as _ , x) ;
166
+ insert_noinline ( & mut vec, 0 , x) ;
168
167
}
169
168
vec
170
169
} ) ;
@@ -179,8 +178,8 @@ fn gen_remove<V: Vector<u64>>(n: usize, b: &mut Bencher) {
179
178
b. iter ( || {
180
179
let mut vec = V :: from_elem ( 0 , n as _ ) ;
181
180
182
- for x in ( 0 ..n - 1 ) . rev ( ) {
183
- remove_noinline ( & mut vec, x ) ;
181
+ for _ in 0 ..n {
182
+ remove_noinline ( & mut vec, 0 ) ;
184
183
}
185
184
} ) ;
186
185
}
You can’t perform that action at this time.
0 commit comments