Skip to content

Commit

Permalink
bench trustedrandomaccess specialization in zip
Browse files Browse the repository at this point in the history
  • Loading branch information
the8472 committed Jan 10, 2024
1 parent 451a3b1 commit 3aa7313
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions library/core/benches/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 3aa7313

Please sign in to comment.