-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Overhaul bezier curve benchmarks #17016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Apply `bench!` macro to all names - Rename benchmarks to be more descriptive of what they do - Deduplicate `build_pos_cubic()` and `build_accel_cubic()`, since they both benchmark the exact same thing! - Move calculation of time for curve easing outside main routine - Move `curve.position()` benchmarks under the same group, and make their routine generic - Remove unnecessary `Vec` allocation from `build_pos_cubic()`
IQuick143
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not entirely familiar with the benchmarking APIs, but the changes all seem reasonable.
Head branch was pushed to by a user without write access
|
Thanks for formatting this for me: manual merge conflict resolution often causes that failure. |
No problem! |
# Objective - Part of bevyengine#16647. - The benchmarks for bezier curves have several issues and do not yet use the new `bench!` naming scheme. ## Solution - Make all `bevy_math` benchmarks use the `bench!` macro for their name. - Delete the `build_accel_cubic()` benchmark, since it was an exact duplicate of `build_pos_cubic()`. - Remove `collect::<Vec<_>>()` call in `build_pos_cubic()` and replace it with a `for` loop. - Combine all of the benchmarks that measure `curve.position()` under a single group, `curve_position`, and extract the common bench routine into a helper function. - Move the time calculation for the `curve.ease()` benchmark into the setup closure so it is not tracked. - Rename the benchmarks to be more descriptive on what they do. - `easing_1000` -> `segment_ease` - `cubic_position_Vec2` -> `curve_position/vec2` - `cubic_position_Vec3A` -> `curve_position/vec3a` - `cubic_position_Vec3` -> `curve_position/vec3` - `build_pos_cubic_100_points` -> `curve_iter_positions` ## Testing - `cargo test -p benches --bench math` - `cargo bench -p benches --bench math` - Then open `./target/criterion/report/index.html` to see the report! --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
# Objective - Part of bevyengine#16647. - The benchmarks for bezier curves have several issues and do not yet use the new `bench!` naming scheme. ## Solution - Make all `bevy_math` benchmarks use the `bench!` macro for their name. - Delete the `build_accel_cubic()` benchmark, since it was an exact duplicate of `build_pos_cubic()`. - Remove `collect::<Vec<_>>()` call in `build_pos_cubic()` and replace it with a `for` loop. - Combine all of the benchmarks that measure `curve.position()` under a single group, `curve_position`, and extract the common bench routine into a helper function. - Move the time calculation for the `curve.ease()` benchmark into the setup closure so it is not tracked. - Rename the benchmarks to be more descriptive on what they do. - `easing_1000` -> `segment_ease` - `cubic_position_Vec2` -> `curve_position/vec2` - `cubic_position_Vec3A` -> `curve_position/vec3a` - `cubic_position_Vec3` -> `curve_position/vec3` - `build_pos_cubic_100_points` -> `curve_iter_positions` ## Testing - `cargo test -p benches --bench math` - `cargo bench -p benches --bench math` - Then open `./target/criterion/report/index.html` to see the report! --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Objective
bench!naming scheme.Solution
bevy_mathbenchmarks use thebench!macro for their name.build_accel_cubic()benchmark, since it was an exact duplicate ofbuild_pos_cubic().collect::<Vec<_>>()call inbuild_pos_cubic()and replace it with aforloop.curve.position()under a single group,curve_position, and extract the common bench routine into a helper function.curve.ease()benchmark into the setup closure so it is not tracked.easing_1000->segment_easecubic_position_Vec2->curve_position/vec2cubic_position_Vec3A->curve_position/vec3acubic_position_Vec3->curve_position/vec3build_pos_cubic_100_points->curve_iter_positionsTesting
cargo test -p benches --bench mathcargo bench -p benches --bench math./target/criterion/report/index.htmlto see the report!