artemis-odb icon indicating copy to clipboard operation
artemis-odb copied to clipboard

[OPTIMIZE] EntitySubscription informEntityChanges

Open exuvo opened this issue 5 years ago • 2 comments

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.

exuvo avatar Feb 13 '20 19:02 exuvo

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.

DaanVanYperen avatar Jul 12 '21 11:07 DaanVanYperen

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.

exuvo avatar Jul 12 '21 14:07 exuvo