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) {
159159
160160 b. iter ( || {
161161 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.
165164 vec. push ( 0 ) ;
166165 for x in 0 ..n {
167- insert_noinline ( & mut vec, x as _ , x) ;
166+ insert_noinline ( & mut vec, 0 , x) ;
168167 }
169168 vec
170169 } ) ;
@@ -179,8 +178,8 @@ fn gen_remove<V: Vector<u64>>(n: usize, b: &mut Bencher) {
179178 b. iter ( || {
180179 let mut vec = V :: from_elem ( 0 , n as _ ) ;
181180
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 ) ;
184183 }
185184 } ) ;
186185}
You can’t perform that action at this time.
0 commit comments