From 2c0c48155d89e6174ba966b052f7aca4f813a52f Mon Sep 17 00:00:00 2001 From: Mike Hsu Date: Sat, 9 Mar 2024 22:15:44 -0800 Subject: [PATCH] add a perf note --- crates/bevy_ecs/src/query/state.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/bevy_ecs/src/query/state.rs b/crates/bevy_ecs/src/query/state.rs index 4e6e388787f40..71eda8c14a864 100644 --- a/crates/bevy_ecs/src/query/state.rs +++ b/crates/bevy_ecs/src/query/state.rs @@ -411,6 +411,12 @@ impl QueryState { /// safe methods on `QueryState` call [`QueryState::update_archetypes`] internally, so /// this is best used through a `Query`. /// + /// ## Performance + /// + /// This will have similar performance as constructing a new `QueryState` since much of internal state + /// needs to be reconstructed. But it will be a little faster as it only needs to compare the intersection + /// of matching archetypes rather than iterating over all archetypes. + /// /// ## Panics /// /// Will panic if `NewD` contains accesses not in `Q` or `OtherQ`.