use commons::collections::*; use criterion::{criterion_group, Criterion}; fn bench_queue(c: &mut Criterion) { let mut q: Queue = Queue::new(); c.bench_function("queue_push", |b| { b.iter(|| { q.push(123); }) }); c.bench_function("queue_pop", |b| { b.iter(|| { q.pop(); }) }); } fn bench_stack(c: &mut Criterion) { let mut s: Stack = Stack::new(); c.bench_function("stack_push", |b| { b.iter(|| { s.push(123); }) }); c.bench_function("stack_pop", |b| { b.iter(|| { s.pop(); }) }); } fn bench_set(c: &mut Criterion) { let mut s: Set = Set::new(); c.bench_function("set_add", |b| b.iter(|| s.add(&[1, 2, 3]))); c.bench_function("set_delete", |b| b.iter(|| s.delete(&[1, 2, 3]))); } criterion_group!(collections, bench_queue, bench_stack, bench_set);