2025: setup bench for day01
This commit is contained in:
parent
d310ec45c0
commit
db1bae8a76
3 changed files with 22 additions and 0 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -139,6 +139,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"aoc",
|
"aoc",
|
||||||
|
"criterion 0.4.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,16 @@ edition = "2024"
|
||||||
aoc = { path = "../aoc" }
|
aoc = { path = "../aoc" }
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
criterion = { version = "0.4", default-features = false, features = [ "rayon" ] }
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "aoc2025"
|
name = "aoc2025"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "aoc2025_bench"
|
||||||
|
harness = false
|
||||||
|
|
|
||||||
14
aoc2025/benches/aoc2025_bench.rs
Normal file
14
aoc2025/benches/aoc2025_bench.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
use criterion::{criterion_group, criterion_main, Criterion};
|
||||||
|
|
||||||
|
use aoc2025::day01;
|
||||||
|
|
||||||
|
fn aoc2025_all(c: &mut Criterion) {
|
||||||
|
c.bench_function("day01", |b| b.iter(|| day01::run().unwrap()));
|
||||||
|
}
|
||||||
|
|
||||||
|
criterion_group! {
|
||||||
|
name = all_days;
|
||||||
|
config = Criterion::default().sample_size(200);
|
||||||
|
targets = aoc2025_all
|
||||||
|
}
|
||||||
|
criterion_main!(all_days);
|
||||||
Loading…
Add table
Add a link
Reference in a new issue