Add bevy_feathers spawning benchmark#24057
Open
greeble-dev wants to merge 7 commits into
Open
Conversation
…ded for benchmarking. This allowed removing the `tracing` dependency.
…cies for other benchmarks.
- Renamed `construct` to `construct_and_drop`.
- Added `drop`.
- Changed `construct_and_spawn` to `spawn_warm` and `spawn_cold`.
- Neither reuse the same app, as that seems like it would distort things with the ECS growing over time.
- `spawn_cold` spawns into a fresh world, so it measures ECS table and archetype creation.
- `spawn_warm` spawns into a world with one copy of the scene already spawned, so tables and archetypes are warmed up.
greeble-dev
commented
May 1, 2026
Comment on lines
+50
to
+55
| // Cconstruct and drop the scene. | ||
| group.bench_function("construct_and_drop", |b| { | ||
| b.iter(move || { | ||
| scene(); | ||
| }); | ||
| }); |
Contributor
Author
There was a problem hiding this comment.
I would have liked to isolate construction, but I didn't find a good way to do this. Instead, the cost of construction can be estimated by subtracting the drop benchmark.
The alternative solutions were:
- Return the scene from the benchmark, but that still doesn't isolate the construct since the ~15KB value needs to be copied.
std::mem::forget, but that means the benchmark needs 2GB of memory.
greeble-dev
commented
May 1, 2026
| # `bench!` macro refers to it in its documentation. | ||
| criterion = { version = "0.8.0", features = ["html_reports"] } | ||
| seq-macro = "0.3.6" | ||
| bevy_feathers = { path = "../crates/bevy_feathers", optional = true } |
Contributor
Author
There was a problem hiding this comment.
Previously, new dependencies went under [dev-dependencies]. But these new dependencies were added to [dependencies] because [dev-dependencies] can't be optional.
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Add a spawning benchmark for
bevy_feathers. This can also serve as a general benchmark for BSN scene spawning.I found a need for this while testing some BSN changes - I wanted to benchmark a large and complex scene, but the existing BSN benchmarks are all pretty small and simple.
Solution
I copy and pasted
feathers_galleryinto a benchmark. That's a bit crude, but gets the job done for now.As requested by #24044, the benchmark is behind an
experimental_bevy_feathersfeature.The PR is a bit behind the current state of
feathers_gallery- it's functional but missing some style updates and minor fixes. I'll update if the PR looks likely to land.Testing
cargo bench -p benches --bench feathers --features "experimental_bevy_feathers"Results
In case anyone's curious, here's the results for my desktop Zen 4:
construct_and_dropdropspawn_coldspawn_warm