Skip to content

Commit

Permalink
Fix broken bezier curve benchmark (#14677)
Browse files Browse the repository at this point in the history
# 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.
  • Loading branch information
mweatherley authored Aug 12, 2024
1 parent c3111be commit 4ace888
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions benches/benches/bevy_math/bezier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))));
});
Expand All @@ -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))));
});
Expand All @@ -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))));
});
Expand All @@ -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::<Vec<_>>()));
});
Expand All @@ -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::<Vec<_>>()));
});
Expand Down

0 comments on commit 4ace888

Please sign in to comment.