artemis-odb
artemis-odb copied to clipboard
[OPTIMIZE] EntitySubscription informEntityChanges
In EntitySubscription informEntityChanges and in turn transferBitsToInts is called even when there are no listeners. Seems unnecessary when i use some subscriptions just for getEntities. Or is my use case very uncommon?
In informEntityChanges
if (!extra.listeners.isEmpty()) { transferBitsToInts(extra.inserted, extra.removed); extra.informEntityChanges(); }
Or maybe inserted/remoevIds.clear still need to run? in which case and else is also needed.
I think your use case is fairly common. Is the performance impact significant? Does the engine add any listeners perhaps?
If we implement this, cleaner to just push most of the informEntityChanges
logic to SubscriptionExtra.
From what i remember the performance impact was small. The engine did not add any own listeners. I was running thousands of ticks per second and was trying to squeeze more out so even small things counted.
I have since moved my game to c++ for the reduced memory usage which also affects performance greatly as the cache usage is much better.