From db1bae8a76e3c24fb013aab598021040ae87f91b Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 2 Dec 2025 17:44:22 +0100 Subject: [PATCH] 2025: setup bench for day01 --- Cargo.lock | 1 + aoc2025/Cargo.toml | 7 +++++++ aoc2025/benches/aoc2025_bench.rs | 14 ++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 aoc2025/benches/aoc2025_bench.rs diff --git a/Cargo.lock b/Cargo.lock index abcf848..5e6c990 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -139,6 +139,7 @@ version = "0.1.0" dependencies = [ "anyhow", "aoc", + "criterion 0.4.0", ] [[package]] diff --git a/aoc2025/Cargo.toml b/aoc2025/Cargo.toml index 41f873e..c1208d6 100644 --- a/aoc2025/Cargo.toml +++ b/aoc2025/Cargo.toml @@ -8,9 +8,16 @@ edition = "2024" aoc = { path = "../aoc" } anyhow = "1.0" +[dev-dependencies] +criterion = { version = "0.4", default-features = false, features = [ "rayon" ] } + [lib] path = "src/lib.rs" [[bin]] name = "aoc2025" path = "src/main.rs" + +[[bench]] +name = "aoc2025_bench" +harness = false diff --git a/aoc2025/benches/aoc2025_bench.rs b/aoc2025/benches/aoc2025_bench.rs new file mode 100644 index 0000000..73c5a0c --- /dev/null +++ b/aoc2025/benches/aoc2025_bench.rs @@ -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);