fabaccess-bffh/runtime/executor/benches/perf.rs
Nadja Reitzenstein 2d9f30b55b Run rustfmt
2022-05-05 15:50:44 +02:00

23 lines
502 B
Rust

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