Skip to content

Commit

Permalink
benches/light: Add benchmark of fast_evaluate_light().
Browse files Browse the repository at this point in the history
  • Loading branch information
kpreid committed Sep 20, 2024
1 parent 76e2f9c commit fbea0cc
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions all-is-cubes/benches/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,36 @@ pub fn evaluate_light_bench(c: &mut Criterion) {
.build()
.unwrap();

let mut group = c.benchmark_group("evaluate");
group.sample_size(10);
for fast in [false, true] {
let mut group = c.benchmark_group(if fast { "fast" } else { "evaluate" });
group.sample_size(if fast { 100 } else { 10 });

group.bench_function("lighting_bench_space", |b| {
b.iter_batched_ref(
|| {
let mut u = Universe::new();
let space = rt
.block_on(lighting_bench_space(
&mut u,
yield_progress_for_testing(),
size3(54, 16, 54),
))
.unwrap();
(u, space)
},
|(_u, space)| {
space.evaluate_light::<time::NoTime>(1, |_| {});
},
BatchSize::LargeInput,
)
});
group.bench_function("lighting_bench_space", |b| {
b.iter_batched_ref(
|| {
let mut u = Universe::new();
let space = rt
.block_on(lighting_bench_space(
&mut u,
yield_progress_for_testing(),
size3(54, 16, 54),
))
.unwrap();
(u, space)
},
|(_u, space)| {
if fast {
space.fast_evaluate_light();
} else {
space.evaluate_light::<time::NoTime>(1, |_| {});
}
},
BatchSize::LargeInput,
)
});

group.finish();
group.finish();
}
}

criterion_group!(benches, evaluate_light_bench);
Expand Down

0 comments on commit fbea0cc

Please sign in to comment.