Rename the benchmark
This commit is contained in:
parent
06573ed2a0
commit
a6afc0b406
3 changed files with 23 additions and 13 deletions
|
@ -15,5 +15,5 @@ sha2 = "0.10.8"
|
||||||
criterion = { version = "0.5.1", features = ["html_reports"] }
|
criterion = { version = "0.5.1", features = ["html_reports"] }
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "small"
|
name = "job_scheduling"
|
||||||
harness = false
|
harness = false
|
||||||
|
|
22
benches/job_scheduling.rs
Normal file
22
benches/job_scheduling.rs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
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);
|
|
@ -1,12 +0,0 @@
|
||||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
|
||||||
use rust_job_scheduling::algorithm::*;
|
|
||||||
use rust_job_scheduling::data::SMALL;
|
|
||||||
|
|
||||||
fn criterion_benchmark(c: &mut Criterion) {
|
|
||||||
c.bench_function("single thread", |b| {
|
|
||||||
b.iter(|| single_thread(black_box(SMALL)))
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
criterion_group!(benches, criterion_benchmark);
|
|
||||||
criterion_main!(benches);
|
|
Loading…
Reference in a new issue