diff --git a/Cargo.toml b/Cargo.toml index dbd6d27..c638765 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,3 +10,10 @@ publish = false [dependencies] pbkdf2 = "0.12.2" sha2 = "0.10.8" + +[dev-dependencies] +criterion = { version = "0.5.1", features = ["html_reports"] } + +[[bench]] +name = "small" +harness = false diff --git a/benches/small.rs b/benches/small.rs new file mode 100644 index 0000000..34f546e --- /dev/null +++ b/benches/small.rs @@ -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);