bevy/crates/bevy_ecs/src/query
James Liu eebf3d61ec
Remove archetype_component_access from QueryState (#12474)
# Objective
`QueryState::archetype_component_access` is only really ever used to
extend `SystemMeta`'s. It can be removed to save some memory for every
`Query` in an app.

## Solution

 * Remove it. 
* Have `new_archetype` pass in a `&mut Access<ArchetypeComponentId>`
instead and pull it from `SystemMeta` directly.
* Split `QueryState::new` from `QueryState::new_with_access` and a
common `QueryState::new_uninitialized`.
* Split `new_archetype` into an internal and public version. Call the
internal version in `update_archetypes`.

This should make it faster to construct new QueryStates, and by proxy
lenses and joins as well.

`matched_tables` also similarly is only used to deduplicate inserting
into `matched_table_ids`. If we can find another efficient way to do so,
it might also be worth removing.

The [generated
assembly](https://github.com/james7132/bevy_asm_tests/compare/main...remove-query-state-archetype-component-access#diff-496530101f0b16e495b7e9b77c0e906ae3068c8adb69ed36c92d5a1be5a9efbe)
reflects this well, with all of the access related updates in
`QueryState` being removed.

---

## Changelog
Removed: `QueryState::archetype_component_access`.
Changed: `QueryState::new_archetype` now takes a `&mut
Access<ArchetypeComponentId>` argument, which will be updated with the
new accesses.
Changed: `QueryState::update_archetype_component_access` now takes a
`&mut Access<ArchetypeComponentId>` argument, which will be updated with
the new accesses.

## Migration Guide
TODO
2024-03-17 19:01:52 +00:00
..
access.rs Update to fixedbitset 0.5 (#12512) 2024-03-17 18:43:05 +00:00
builder.rs remove repetitive code (#12270) 2024-03-03 07:58:22 +00:00
error.rs Remove APIs deprecated in 0.13 (#11974) 2024-02-19 19:04:47 +00:00
fetch.rs Remove ComponentStorage and associated types (#12311) 2024-03-05 15:54:52 +00:00
filter.rs Remove ComponentStorage and associated types (#12311) 2024-03-05 15:54:52 +00:00
iter.rs Check cfg during CI and fix feature typos (#12103) 2024-02-25 15:19:27 +00:00
mod.rs Remove APIs deprecated in 0.13 (#11974) 2024-02-19 19:04:47 +00:00
par_iter.rs Check cfg during CI and fix feature typos (#12103) 2024-02-25 15:19:27 +00:00
state.rs Remove archetype_component_access from QueryState (#12474) 2024-03-17 19:01:52 +00:00
world_query.rs bevy_ecs address trivial cases of unsafe_op_in_unsafe_fn (#11861) 2024-02-22 00:04:38 +00:00