18 lines
471 B
Rust
18 lines
471 B
Rust
|
use array_queue::ArrayQueue;
|
||
|
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||
|
|
||
|
fn push_pop_50(mut queue: ArrayQueue<u8, 100>) {
|
||
|
for _ in 0..50 {
|
||
|
queue.push(5);
|
||
|
let _ = queue.pop();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn criterion_benchmark(c: &mut Criterion) {
|
||
|
let queue = ArrayQueue::default();
|
||
|
c.bench_function("push/pull 50", |b| b.iter(move || push_pop_50(queue)));
|
||
|
}
|
||
|
|
||
|
criterion_group!(benches, criterion_benchmark);
|
||
|
criterion_main!(benches);
|