Bench iter() and iter().rev()
This commit is contained in:
parent
59f4e8a7d4
commit
2bce1c31a6
|
@ -136,6 +136,30 @@ fn mat500_mul_mat500(bench: &mut criterion::Criterion) {
|
||||||
bench.bench_function("mat500_mul_mat500", move |bh| bh.iter(|| &a * &b));
|
bench.bench_function("mat500_mul_mat500", move |bh| bh.iter(|| &a * &b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn iter(bench: &mut criterion::Criterion) {
|
||||||
|
let a = DMatrix::<f64>::new_random(1000, 1000);
|
||||||
|
|
||||||
|
bench.bench_function("iter", move |bh| {
|
||||||
|
bh.iter(|| {
|
||||||
|
for value in a.iter() {
|
||||||
|
criterion::black_box(value);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fn iter_rev(bench: &mut criterion::Criterion) {
|
||||||
|
let a = DMatrix::<f64>::new_random(1000, 1000);
|
||||||
|
|
||||||
|
bench.bench_function("iter_rev", move |bh| {
|
||||||
|
bh.iter(|| {
|
||||||
|
for value in a.iter().rev() {
|
||||||
|
criterion::black_box(value);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
fn copy_from(bench: &mut criterion::Criterion) {
|
fn copy_from(bench: &mut criterion::Criterion) {
|
||||||
let a = DMatrix::<f64>::new_random(1000, 1000);
|
let a = DMatrix::<f64>::new_random(1000, 1000);
|
||||||
let mut b = DMatrix::<f64>::new_random(1000, 1000);
|
let mut b = DMatrix::<f64>::new_random(1000, 1000);
|
||||||
|
@ -235,6 +259,8 @@ criterion_group!(
|
||||||
mat10_mul_mat10_static,
|
mat10_mul_mat10_static,
|
||||||
mat100_mul_mat100,
|
mat100_mul_mat100,
|
||||||
mat500_mul_mat500,
|
mat500_mul_mat500,
|
||||||
|
iter,
|
||||||
|
iter_rev,
|
||||||
copy_from,
|
copy_from,
|
||||||
axpy,
|
axpy,
|
||||||
tr_mul_to,
|
tr_mul_to,
|
||||||
|
|
Loading…
Reference in New Issue