From 4ace888e4b5c054ca56f0211f399a9df49aa5798 Mon Sep 17 00:00:00 2001 From: Matty Date: Mon, 12 Aug 2024 12:10:11 -0400 Subject: [PATCH] Fix broken bezier curve benchmark (#14677) # Objective Apparently #14382 broke this, but it's not a part of CI, so it wasn't found until earlier today. ## Solution Update the benchmark like we updated the examples. ## Testing Running `cargo bench` actually works now. --- benches/benches/bevy_math/bezier.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/benches/benches/bevy_math/bezier.rs b/benches/benches/bevy_math/bezier.rs index 10645a5997..69590aa804 100644 --- a/benches/benches/bevy_math/bezier.rs +++ b/benches/benches/bevy_math/bezier.rs @@ -20,7 +20,8 @@ fn cubic_2d(c: &mut Criterion) { vec2(1.0, 0.0), vec2(1.0, 1.0), ]]) - .to_curve(); + .to_curve() + .expect("Unable to build a curve from this data"); c.bench_function("cubic_position_Vec2", |b| { b.iter(|| black_box(bezier.position(black_box(0.5)))); }); @@ -33,7 +34,8 @@ fn cubic(c: &mut Criterion) { vec3a(1.0, 0.0, 0.0), vec3a(1.0, 1.0, 1.0), ]]) - .to_curve(); + .to_curve() + .expect("Unable to build a curve from this data"); c.bench_function("cubic_position_Vec3A", |b| { b.iter(|| black_box(bezier.position(black_box(0.5)))); }); @@ -46,7 +48,8 @@ fn cubic_vec3(c: &mut Criterion) { vec3(1.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0), ]]) - .to_curve(); + .to_curve() + .expect("Unable to build a curve from this data"); c.bench_function("cubic_position_Vec3", |b| { b.iter(|| black_box(bezier.position(black_box(0.5)))); }); @@ -59,7 +62,8 @@ fn build_pos_cubic(c: &mut Criterion) { vec3a(1.0, 0.0, 0.0), vec3a(1.0, 1.0, 1.0), ]]) - .to_curve(); + .to_curve() + .expect("Unable to build a curve from this data"); c.bench_function("build_pos_cubic_100_points", |b| { b.iter(|| black_box(bezier.iter_positions(black_box(100)).collect::>())); }); @@ -72,7 +76,8 @@ fn build_accel_cubic(c: &mut Criterion) { vec3a(1.0, 0.0, 0.0), vec3a(1.0, 1.0, 1.0), ]]) - .to_curve(); + .to_curve() + .expect("Unable to build a curve from this data"); c.bench_function("build_accel_cubic_100_points", |b| { b.iter(|| black_box(bezier.iter_positions(black_box(100)).collect::>())); });