Skip to content

ECS: cache queries #6

@jorgefz

Description

@jorgefz

ECS systems need to query the "world" for all entities with the requested set of components. Systems may also need to run every frame, and so caching these queries would constitute a significant improvement to the performance of the application.
Queries can be cached in a hashmap that maps a set of components to an array with all entities that share those components.

The problem is signalling the cache that an entity has gained/lost a component so it is re-run. When this happens, on the AddComponent or RemoveComponent functions, one would have to iterate over all cached queries to find those that share that component and tell them to reset themselves, which could be more expensive than just not caching them.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthardDifficult to implement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions