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.
This commit is contained in:
Matty 2024-08-12 12:10:11 -04:00 committed by GitHub
parent c3111bebb8
commit 4ace888e4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,7 +20,8 @@ fn cubic_2d(c: &mut Criterion) {
vec2(1.0, 0.0), vec2(1.0, 0.0),
vec2(1.0, 1.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| { c.bench_function("cubic_position_Vec2", |b| {
b.iter(|| black_box(bezier.position(black_box(0.5)))); 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, 0.0, 0.0),
vec3a(1.0, 1.0, 1.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| { c.bench_function("cubic_position_Vec3A", |b| {
b.iter(|| black_box(bezier.position(black_box(0.5)))); 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, 0.0, 0.0),
vec3(1.0, 1.0, 1.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| { c.bench_function("cubic_position_Vec3", |b| {
b.iter(|| black_box(bezier.position(black_box(0.5)))); 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, 0.0, 0.0),
vec3a(1.0, 1.0, 1.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| { c.bench_function("build_pos_cubic_100_points", |b| {
b.iter(|| black_box(bezier.iter_positions(black_box(100)).collect::<Vec<_>>())); b.iter(|| black_box(bezier.iter_positions(black_box(100)).collect::<Vec<_>>()));
}); });
@ -72,7 +76,8 @@ fn build_accel_cubic(c: &mut Criterion) {
vec3a(1.0, 0.0, 0.0), vec3a(1.0, 0.0, 0.0),
vec3a(1.0, 1.0, 1.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| { c.bench_function("build_accel_cubic_100_points", |b| {
b.iter(|| black_box(bezier.iter_positions(black_box(100)).collect::<Vec<_>>())); b.iter(|| black_box(bezier.iter_positions(black_box(100)).collect::<Vec<_>>()));
}); });