aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tests/Cargo.toml4
-rw-r--r--src/tests/aoc-2021-09/benches/main.rs4
-rw-r--r--src/tests/aoc-2022-08/benches/main.rs4
-rw-r--r--src/tests/aoc-2022-09/benches/main.rs4
-rw-r--r--src/tests/aoc-2022-14/benches/main.rs8
-rw-r--r--src/tests/example_sets/benches/main.rs10
-rw-r--r--src/tests/example_stack/benches/do_stuff.rs4
7 files changed, 22 insertions, 16 deletions
diff --git a/src/tests/Cargo.toml b/src/tests/Cargo.toml
index a8d75c8..15e8d64 100644
--- a/src/tests/Cargo.toml
+++ b/src/tests/Cargo.toml
@@ -1,12 +1,12 @@
[workspace]
resolver = "2"
members = [
+ "example_sets",
+ "example_stack",
"aoc-2021-09",
"aoc-2022-08",
"aoc-2022-09",
"aoc-2022-14",
- "example_sets",
- "example_stack",
"prime_sieve"
]
diff --git a/src/tests/aoc-2021-09/benches/main.rs b/src/tests/aoc-2021-09/benches/main.rs
index 2ebfbec..c5a2037 100644
--- a/src/tests/aoc-2021-09/benches/main.rs
+++ b/src/tests/aoc-2021-09/benches/main.rs
@@ -5,7 +5,7 @@ use rand::{rngs::StdRng, SeedableRng};
fn run_benches(c: &mut Criterion) {
let mut rng = StdRng::seed_from_u64(42);
for size in [100].iter() {
- c.bench_with_input(BenchmarkId::new("part1", size), size, |b, &n| {
+ c.bench_with_input(BenchmarkId::new("aoc-202109-part1", size), size, |b, &n| {
b.iter_batched_ref(
|| HeightMap::gen(&mut rng, n),
|map| map.part1(),
@@ -13,7 +13,7 @@ fn run_benches(c: &mut Criterion) {
)
});
- c.bench_with_input(BenchmarkId::new("part2", size), size, |b, &n| {
+ c.bench_with_input(BenchmarkId::new("aoc-202109-part2", size), size, |b, &n| {
b.iter_batched_ref(
|| HeightMap::gen(&mut rng, n),
|map| map.part2(),
diff --git a/src/tests/aoc-2022-08/benches/main.rs b/src/tests/aoc-2022-08/benches/main.rs
index ceab4a8..438f926 100644
--- a/src/tests/aoc-2022-08/benches/main.rs
+++ b/src/tests/aoc-2022-08/benches/main.rs
@@ -5,7 +5,7 @@ use rand::{rngs::StdRng, SeedableRng};
fn run_benches(c: &mut Criterion) {
let mut rng = StdRng::seed_from_u64(42);
for size in [100, 500, 1000, 2000].iter() {
- c.bench_with_input(BenchmarkId::new("part1", size), size, |b, &n| {
+ c.bench_with_input(BenchmarkId::new("aoc-202208-part1", size), size, |b, &n| {
b.iter_batched_ref(
|| HeightMap::gen(&mut rng, n),
|map| map.part1(),
@@ -13,7 +13,7 @@ fn run_benches(c: &mut Criterion) {
)
});
- c.bench_with_input(BenchmarkId::new("part2", size), size, |b, &n| {
+ c.bench_with_input(BenchmarkId::new("aoc-202208-part2", size), size, |b, &n| {
b.iter_batched_ref(
|| HeightMap::gen(&mut rng, n),
|map| map.part2(),
diff --git a/src/tests/aoc-2022-09/benches/main.rs b/src/tests/aoc-2022-09/benches/main.rs
index bd5f92c..3b4046c 100644
--- a/src/tests/aoc-2022-09/benches/main.rs
+++ b/src/tests/aoc-2022-09/benches/main.rs
@@ -5,7 +5,7 @@ use rand::{rngs::StdRng, SeedableRng};
fn run_benches(c: &mut Criterion) {
let mut rng = StdRng::seed_from_u64(42);
for size in [100, 1000, 2000, 10_000, 50_000].iter() {
- c.bench_with_input(BenchmarkId::new("part1", size), size, |b, &n| {
+ c.bench_with_input(BenchmarkId::new("aoc-202209-part1", size), size, |b, &n| {
b.iter_batched_ref(
|| gen_moves(&mut rng, n).collect::<Vec<_>>(),
|moves| part1(moves.iter()),
@@ -13,7 +13,7 @@ fn run_benches(c: &mut Criterion) {
)
});
- c.bench_with_input(BenchmarkId::new("part2", size), size, |b, &n| {
+ c.bench_with_input(BenchmarkId::new("aoc-202209-part2", size), size, |b, &n| {
b.iter_batched_ref(
|| gen_moves(&mut rng, n).collect::<Vec<_>>(),
|moves| part2(moves.iter()),
diff --git a/src/tests/aoc-2022-14/benches/main.rs b/src/tests/aoc-2022-14/benches/main.rs
index 5ac0f39..8ca2664 100644
--- a/src/tests/aoc-2022-14/benches/main.rs
+++ b/src/tests/aoc-2022-14/benches/main.rs
@@ -4,23 +4,23 @@ use rand::{rngs::StdRng, SeedableRng};
fn run_benches(c: &mut Criterion) {
c.bench_with_input(
- BenchmarkId::new("part1", "small"),
+ BenchmarkId::new("aoc-202214-part1", "small"),
&SMALL_INPUT,
|b, &inp| b.iter_batched_ref(|| parse_input(inp), |w| w.part1(), BatchSize::SmallInput),
);
c.bench_with_input(
- BenchmarkId::new("part1", "large"),
+ BenchmarkId::new("aoc-202214-part1", "large"),
&LARGE_INPUT,
|b, &inp| b.iter_batched_ref(|| parse_input(inp), |w| w.part1(), BatchSize::SmallInput),
);
c.bench_with_input(
- BenchmarkId::new("part2", "small"),
+ BenchmarkId::new("aoc-202214-part2", "small"),
&SMALL_INPUT,
|b, &inp| b.iter_batched_ref(|| parse_input(inp), |w| w.part2(), BatchSize::SmallInput),
);
c.bench_with_input(
- BenchmarkId::new("part2", "large"),
+ BenchmarkId::new("aoc-202214-part2", "large"),
&LARGE_INPUT,
|b, &inp| b.iter_batched_ref(|| parse_input(inp), |w| w.part2(), BatchSize::SmallInput),
);
diff --git a/src/tests/example_sets/benches/main.rs b/src/tests/example_sets/benches/main.rs
index f72afdb..3092cdf 100644
--- a/src/tests/example_sets/benches/main.rs
+++ b/src/tests/example_sets/benches/main.rs
@@ -2,9 +2,13 @@ use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
fn run_benches(c: &mut Criterion) {
for size in [10, 500, 10_000, 50_000].iter() {
- c.bench_with_input(BenchmarkId::new("insert_n", size), size, |b, &n| {
- b.iter(|| example_sets::insert_n(n));
- });
+ c.bench_with_input(
+ BenchmarkId::new("example_sets-insert_n", size),
+ size,
+ |b, &n| {
+ b.iter(|| example_sets::insert_n(n));
+ },
+ );
}
}
diff --git a/src/tests/example_stack/benches/do_stuff.rs b/src/tests/example_stack/benches/do_stuff.rs
index c7e2e23..91f21fb 100644
--- a/src/tests/example_stack/benches/do_stuff.rs
+++ b/src/tests/example_stack/benches/do_stuff.rs
@@ -1,7 +1,9 @@
use criterion::{criterion_group, criterion_main, Criterion};
fn run_benches(c: &mut Criterion) {
- c.bench_function("do_something", |b| b.iter(|| example_stack::do_something()));
+ c.bench_function("example_stack-do_something", |b| {
+ b.iter(|| example_stack::do_something())
+ });
}
criterion_group!(benches, run_benches);