Add a first benchmark

This commit is contained in:
Rodolphe Bréard 2024-10-27 19:37:24 +01:00
parent 7e797ab644
commit db56ea6fe4
2 changed files with 19 additions and 0 deletions

View file

@ -10,3 +10,10 @@ publish = false
[dependencies] [dependencies]
pbkdf2 = "0.12.2" pbkdf2 = "0.12.2"
sha2 = "0.10.8" sha2 = "0.10.8"
[dev-dependencies]
criterion = { version = "0.5.1", features = ["html_reports"] }
[[bench]]
name = "small"
harness = false

12
benches/small.rs Normal file
View file

@ -0,0 +1,12 @@
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);