bench trustedrandomaccess specialization in zip

This commit is contained in:
The8472 2021-06-12 10:39:00 +02:00 committed by The 8472
parent 451a3b1775
commit 3aa73135cf

View File

@ -391,6 +391,19 @@ fn bench_skip_then_zip(b: &mut Bencher) {
});
}
#[bench]
fn bench_skip_trusted_random_access(b: &mut Bencher) {
let v: Vec<u64> = black_box(vec![42; 10000]);
let mut sink = [0; 10000];
b.iter(|| {
for (val, idx) in v.iter().skip(8).zip(0..10000) {
sink[idx] += val;
}
sink
});
}
#[bench]
fn bench_filter_count(b: &mut Bencher) {
b.iter(|| (0i64..1000000).map(black_box).filter(|x| x % 3 == 0).count())