bevy/crates/bevy_ecs/src
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
..
entity Fix inconsistency between Debug and serialized representation of Entity (#12469) 2024-03-14 14:57:22 +00:00
identifier fix some typos (#12038) 2024-02-22 18:55:22 +00:00
query Remove archetype_component_access from QueryState (#12474) 2024-03-17 19:01:52 +00:00
reflect Move commands module into bevy::ecs::world (#12234) 2024-03-02 23:13:45 +00:00
schedule Split ScheduleGraph::process_configs function (adopted) (#12435) 2024-03-17 02:00:37 +00:00
storage Use NonMaxUsize for non-component SparseSets (#12083) 2024-03-03 14:55:27 +00:00
system Remove archetype_component_access from QueryState (#12474) 2024-03-17 19:01:52 +00:00
world Remove initialize_resource<T> and friends (#12307) 2024-03-05 16:09:13 +00:00
archetype.rs Query Joins (#11535) 2024-03-11 19:07:36 +00:00
bundle.rs Clean up pointer use in BundleSpawner/BundleInserter (#12269) 2024-03-06 05:52:18 +00:00
change_detection.rs Implement MutUntyped::from(mut_typed) (#12406) 2024-03-10 12:46:50 +00:00
component.rs Remove ComponentStorage and associated types (#12311) 2024-03-05 15:54:52 +00:00
event.rs Fix bug where events are not being dropped (#11528) 2024-02-02 21:14:54 +00:00
lib.rs Add "all-features = true" to docs.rs metadata for most crates (#12366) 2024-03-08 20:03:09 +00:00
removal_detection.rs Docs reflect that RemovalDetection also yields despawned entities (#11795) 2024-02-10 11:18:05 +00:00