use commons::sort::*; use criterion::{criterion_group, Criterion}; fn bench_sort(c: &mut Criterion) { let mut elems = vec![ 0, 1, 3, 2, 333, 54, 3, 42, 3, 2, 1, 4, 3, 52, 3, 21, 6666, 10000, ]; c.bench_function("bubble_sort", |b| { b.iter(|| { bubble_sort(&mut elems); }) }); c.bench_function("selection_sort", |b| { b.iter(|| { selection_sort(&mut elems); }) }); c.bench_function("insertion_sort", |b| b.iter(|| insertion_sort(&mut elems))); c.bench_function("shell_sort", |b| b.iter(|| shell_sort(&mut elems))); c.bench_function("quick_sort", |b| { b.iter(|| { quick_sort(&mut elems); }) }); } criterion_group!(sort, bench_sort);