Closed delaneyj closed 8 months ago
Nice, thanks for the suggestion. I've implemented this and it gave a small but noticeable improvement. I also moved the entities[i>>entityPageBits] pointer dereference out of the hot loop. Those two together made Select ~30% faster on my machine.
Looks like using a range for loop was also faster than a C style for loop, probably because it allows the compiler to elide the bounds check on the slice access. I've implemented that as well.
Like #2 there is an opportunity to fast out of Select
match
If the first
match
is false then it could early out. Not huge in this case but with you have more components its a way to early out. The other option is to at pub/sub and have theSelect
have lists of entities to iterate knowing that don't have to match.