-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Add an optional bitmap-indexed query/filter path for high-churn ECS workloads #23985
Copy link
Copy link
Open
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile timesD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite challenging from either a design or technical perspective. Ask for help!S-Needs-BenchmarkingThis set of changes needs performance benchmarking to double-check that they helpThis set of changes needs performance benchmarking to double-check that they helpS-Needs-Design-DocThis issue or PR is particularly complex, and needs an approved design doc before it can be mergedThis issue or PR is particularly complex, and needs an approved design doc before it can be merged
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile timesD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite challenging from either a design or technical perspective. Ask for help!S-Needs-BenchmarkingThis set of changes needs performance benchmarking to double-check that they helpThis set of changes needs performance benchmarking to double-check that they helpS-Needs-Design-DocThis issue or PR is particularly complex, and needs an approved design doc before it can be mergedThis issue or PR is particularly complex, and needs an approved design doc before it can be merged
Type
Projects
Status
Needs SME Triage
What problem does this solve or what need does it fill?
Bevy ECS is very fast for dense archetype/table iteration, but some workloads are less ideal for the current model:
With<T>/Without<T>filtersIn these cases, filtering cost and archetype churn can become significant. It would be useful to investigate whether Bevy ECS could benefit from an optional bitmap index for component presence, inspired by the approach used in StaticEcs.
What solution would you like?
Add an optional bitmap-indexed query/filter path to Bevy ECS.
The idea is that component presence could be represented as bitmaps, allowing queries like:
to be evaluated conceptually as:
This should not replace Bevy’s current archetype/table storage. Instead, it could be an internal optimization for specific cases, such as marker-heavy or high-churn components.
Ideally, this would require little or no new query syntax. Existing queries could automatically use bitmap filtering when it is beneficial.
What alternative(s) have you considered?
These workarounds can help, but they either reduce ECS ergonomics, require manual synchronization, or do not directly address filter-heavy query performance.
Additional context
This idea is inspired by the Bitmap Index / hierarchical inverted bitmap approach implemented in StaticEcs:
https://github.com/Felid-Force-Studios/StaticEcs
The request is not to replace Bevy ECS with StaticEcs’ architecture, but to explore whether a similar bitmap-based filtering mechanism could be useful as an optional optimization inside Bevy ECS.