mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
bench trustedrandomaccess specialization in zip
This commit is contained in:
parent
451a3b1775
commit
3aa73135cf
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user