stop using bench_with_setup on surface_nets
@@ -7,17 +7,9 @@ use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
fn surface_nets_sine_sdf(c: &mut Criterion) {
let mut group = c.benchmark_group("surface_nets_sine_sdf");
for diameter in [8, 16, 32, 64].iter() {
- group.bench_with_input(
- BenchmarkId::from_parameter(diameter),
- diameter,
- |b, &diameter| {
- b.iter_with_setup(
- || {
let radius = diameter >> 1;
- let sample_extent = Extent3i::from_min_and_max(
- Point3i::fill(-radius),
- Point3i::fill(radius),
- );
+ let sample_extent =
+ Extent3i::from_min_and_max(Point3i::fill(-radius), Point3i::fill(radius));
let mut samples = Array3x1::fill(sample_extent, Sd8(0));
copy_extent(&sample_extent, &Func(sine_sdf), &mut samples);
@@ -25,14 +17,9 @@ fn surface_nets_sine_sdf(c: &mut Criterion) {
let mut buffer = SurfaceNetsBuffer::default();
surface_nets(&samples, samples.extent(), 1.0, true, &mut buffer);
- (samples, buffer)
- },
- |(samples, mut buffer)| {
- surface_nets(&samples, samples.extent(), 1.0, true, &mut buffer)
- },
- );
- },
- );
+ group.bench_with_input(BenchmarkId::from_parameter(diameter), &(), |b, _| {
+ b.iter(|| surface_nets(&samples, samples.extent(), 1.0, true, &mut buffer));
+ });
}
group.finish();
}
