You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a basic Isometric tile game with hundreds of entities belonging to a tilemap, this causes a significant lag each tick as we iterate every child but then take no action as nothing needs to respond to these events other than the scene, viewport etc which already have their own overrides for _resizeEvent anyways.
In my fork, I've simply commented out this entire method which has improved performance with no side effects but as I have a limited use-case I was wondering what a better solution to this might be before I sent a PR that might break things for others. Thanks!
The text was updated successfully, but these errors were encountered:
Hello @Irrelon, I've re-opened this as the issue has returned in the new branch.
The issue is with adding entities to a tilemap in bulk. For each call to mount() on the parent, we iterate all the children and call their _resizeEvent() method, which ends up in the method being invoked n! (factorial) times.
I have a custom tilemap class so I've worked around this by overriding the _resizeEvent method to be a no-op. I do wonder if it's worth changing the default behaviour though as this could catch people out.
beyond-code-github
changed the title
Default behavior of _resizeEvent on IgeObject causes performance hit
IGE-ES6 - Default behavior of _resizeEvent on IgeObject causes performance hit
Apr 26, 2023
By default every IgeObject gets an implementation of _resizeEvent that loops each child entity and calls their _resizeEvents in turn:
ige/engine/core/IgeObject.js
Line 1663 in cd4f470
For a basic Isometric tile game with hundreds of entities belonging to a tilemap, this causes a significant lag each tick as we iterate every child but then take no action as nothing needs to respond to these events other than the scene, viewport etc which already have their own overrides for _resizeEvent anyways.
In my fork, I've simply commented out this entire method which has improved performance with no side effects but as I have a limited use-case I was wondering what a better solution to this might be before I sent a PR that might break things for others. Thanks!
The text was updated successfully, but these errors were encountered: