-
Notifications
You must be signed in to change notification settings - Fork 86
Optimize scene node child removal to constant time #275
Conversation
I know we discussed on the issue, but still wanted to ask:
(The idea is clever, btw. Just seems easy to accidentally break in the future.) |
Tested, works. |
I'm not sure. I can imagine keeping the insertion order to be useful, for example when scene nodes need to be drawn in a particular order due to depth sorting. I don't know whether our current implementation relies on this however, since entities, particles, and mapblocks are all depth-sorted by Minetest.
We probably could, but I'm not sure an unordered set is a good idea. Pros:
Cons:
As said on the issue, I believe this is well encapsulated by the add / remove child methods of I also don't expect this (the children management in particular) to be touched often, looking at the history. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested a bit, didn't crash
An attempt at fixing #274, briefly tested with Shadow Forest, but not profiled.
This relies on two invariants in
removeChild
:You can experimentally verify that these seem to hold by replacing the body of
removeChild
with the less efficient:The
assert
s should not be tripped.