Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query caching #17

Open
TomGillen opened this issue Nov 4, 2019 · 0 comments
Open

Query caching #17

TomGillen opened this issue Nov 4, 2019 · 0 comments
Labels
help wanted Extra attention is needed type: feature New feature or request

Comments

@TomGillen
Copy link
Collaborator

Most of the filters within a query are deterministic and will always yield the same result for each archetype/chunkset/chunk. The only exception to this is the ComponentChangedFilter.

If we could cache the matches for a query between executions, we could skip most of the work and need only resume the query from the last archetype/chunkset/chunk it had seen, needing only to inspect new elements. Caching for all three levels in a data structure that is faster to read than the full query itself may be tricky, but caching only archetype matches should be trivial and offer significant potential performance gains.

This could tie well into system execution. Systems currently need to pre-execute queries to determine which archetypes the system will access, as part of its scheduling logic. If systems could cache their archetype matches between executions, then that would both allow for incremental querying (inspecting only new archetypes each frame), and eliminate an additional query execution from each system. It would also allow systems to cheaply determine if their queries match any entities, which may allow us to automatically disable inactive systems (although this would have to be opt-in for each system).

@TomGillen TomGillen added type: feature New feature or request help wanted Extra attention is needed labels Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed type: feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant