fabaccess-bffh/runtime/executor/benches/perf.rs

22 lines
500 B
Rust
Raw Normal View History

use executor::prelude::*;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
2021-11-14 17:51:48 +01:00
fn increment(b: &mut Criterion) {
2021-11-14 17:51:48 +01:00
let mut sum = 0;
let executor = Executor::new();
2021-11-14 17:51:48 +01:00
b.bench_function("Executor::run", |b| b.iter(|| {
executor.run(
2021-11-14 17:51:48 +01:00
async {
(0..10_000_000).for_each(|_| {
sum += 1;
});
},
);
}));
2021-11-14 17:51:48 +01:00
black_box(sum);
}
criterion_group!(perf, increment);
criterion_main!(perf);