Closed ProgrammingLife closed 1 year ago
Is it necessary to call query on every frame tick if there are no changes since the last frame, and many other previous frames?
When you say changes, do you mean add/removeComponent
changes? Or a direct data manipulation component.data[eid] = 3
type of change?
Assuming you meant add/removeComponent
, then you don't have to worry. Queries are cached and incrementally updated when components are added/removed. Calling the query simply passes back an array, it doesn't do any filtering.
Wow, thanks! That's what I exactly meant! (add/removeComponent). You're doing very useful work with BitECS. Thanks!
Let's say we have some system defined like this:
Is it necessary to call
query
on every frame tick if there are no changes since the last frame, and many other previous frames? Are there some optimization tricks to cache the output of that query and just reuse it? Maybe this can be done internally inside thequery
function in BitECS as it can track a list of queried components?