Skip to content

Commit 94f5f62

Browse files
committed
bench trustedrandomaccess specialization in zip
1 parent 1a950fa commit 94f5f62

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: library/core/benches/iter.rs

+13
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,19 @@ fn bench_skip_then_zip(b: &mut Bencher) {
391391
});
392392
}
393393

394+
#[bench]
395+
fn bench_skip_trusted_random_access(b: &mut Bencher) {
396+
let v: Vec<u64> = black_box(vec![42; 10000]);
397+
let mut sink = [0; 10000];
398+
399+
b.iter(|| {
400+
for (val, idx) in v.iter().skip(8).zip(0..10000) {
401+
sink[idx] += val;
402+
}
403+
sink
404+
});
405+
}
406+
394407
#[bench]
395408
fn bench_filter_count(b: &mut Bencher) {
396409
b.iter(|| (0i64..1000000).map(black_box).filter(|x| x % 3 == 0).count())

0 commit comments

Comments
 (0)