Skip to content

Optimize table-only component queries with sparse set filters #1563

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

Closed
alice-i-cecile opened this issue Mar 5, 2021 · 1 comment
Closed
Labels
A-ECS Entities, components, systems, and events C-Performance A change motivated by improving speed, memory usage or compile times

Comments

@alice-i-cecile
Copy link
Member

Sparse set components are most commonly used as simple unit struct marker components, so will show up a lot in query filters.

table iteration can (currently) only be used when the query only contains table components (this includes filters). if you add a sparse component/filter, the query will switch to "archetype iteration".
"hybrid queries" will still be faster than "full sparse set" queries, but they are still "archetype iterators"
the reason we can't use table iteration for "sparse filters" is that the With / Without information isn't stored in Tables (its in Archetypes). There is a 1->many relationship between tables and archetypes (each row of a table might belong to a different archetype).
Some of the items in the table might match the query filter, others might not
whereas we can make that guarantee when the filters are table-only
as we can just check to see if the table has that component type
there is a world where we enable storing archetype information in table rows to accelerate sparse filters
or alternatively, allocating blocks in tables for a given archetype
eh maybe not the second one
otherwise we're back to square one when it comes to "add/remove operation costs"

From Discord.

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Performance A change motivated by improving speed, memory usage or compile times labels Mar 5, 2021
@alice-i-cecile
Copy link
Member Author

Duplicate of #2144.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Performance A change motivated by improving speed, memory usage or compile times
Projects
None yet
Development

No branches or pull requests

1 participant