L3P3 / lui

Tiny, robust web framework in my taste.

Home Page:https://l3p3.de/dok/lui.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flag subtree that does not need unmounting

L3P3 opened this issue · comments

commented

IS

When unmounting a subtree, all of it is checked for unmounting tasks to do, including removing every child node.

SHOULD

When unmounting a subtree, only its top-level element is removed and only its subtrees are unmounted that contain unmounting actions.

NOTE

This will speed up some benchmarks. 😉

commented

Keeping track of which subtree needs unmount action is also an overhead. We need to find out if it is worth it.
My current idea is to have a counter for every node that keeps track of the number of childs that need unmounting. When decrementing to 0, we decrement the parent. When incrementing to 1, we increment the parent.
When a hook that needs unmounting is called for the first time, the own counter is incremented. So the counter actually represents unmounting children + own unmounting hooks. Obviously, this means that it cannot go down to 0 again when the node itself has unmounting hooks. This is fine.