mirror of
https://github.com/bevyengine/bevy
synced 2024-11-25 22:20:20 +00:00
2486343e87
# Objective Improve the performance of animation. `animate_targets` only does work for entities with a `AnimationTarget` component, but the query it uses has no filters and matches all archetypes, resulting in extra work checking and ignoring every other entity in the world. In addition, it uses `EntityMutExcept::get`, which has to look up the `ComponentId` for `AnimationTarget` each time it's used. Fixes #15412 ## Solution Instead of `entity_mut.get::<AnimationTarget>()`, add `&AnimationTarget` to the query and read it directly. This requires adding `AnimationTarget` to the list of exceptions in the `EntityMutExcept`. Since the resulting type is getting long, add an alias for it. This does mean that `AnimationTarget` is no longer available through `entity`, which means it's not possible to animate the `AnimationTarget` component itself. ## Testing I ran performance traces of many_foxes comparing this branch to main. Red is main, yellow is these changes: ![image](https://github.com/user-attachments/assets/93ef7d70-5103-4952-86b9-312aafc53e5f) |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |