Skip to content

Commit f21bc09

Browse files
committed
add a perf note
1 parent 6bfea24 commit f21bc09

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

crates/bevy_ecs/src/query/state.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,12 @@ impl<D: QueryData, F: QueryFilter> QueryState<D, F> {
411411
/// safe methods on `QueryState` call [`QueryState::update_archetypes`] internally, so
412412
/// this is best used through a `Query`.
413413
///
414+
/// ## Performance
415+
///
416+
/// This will have similar performace as constructing a new `QueryState` since much of internal state
417+
/// needs to be reconstructed. But it will be a little faster as it only needs to compare the intersection
418+
/// of matching archetypes rather than iterating over all archetypes.
419+
///
414420
/// ## Panics
415421
///
416422
/// Will panic if `NewD` contains accesses not in `Q` or `OtherQ`.

0 commit comments

Comments
 (0)