use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; use rust_job_scheduling::algorithm::*; use rust_job_scheduling::data::SMALL; use rust_job_scheduling::Task; const TEST_DATA: &[(&str, &[Task])] = &[("small", SMALL)]; const TEST_FUNCS: &[(&str, &dyn Fn(&[Task]))] = &[("single thread", &single_thread)]; fn job_scheduling_benchmark(c: &mut Criterion) { let mut group = c.benchmark_group("job_scheduling"); for (data_name, data) in TEST_DATA { for (func_name, func) in TEST_FUNCS { group.bench_with_input(BenchmarkId::new(*func_name, data_name), data, |b, i| { b.iter(|| func(i)) }); } } group.finish(); } criterion_group!(benches, job_scheduling_benchmark); criterion_main!(benches);