Fixes issues where most of the tree gets thrown away in case of temp tree overflow during tree gc. Happened with Lizzie when analyzing sometimes for example.
Until now tree_prune() was processing the tree depth-first, but this creates issues in case of overflow: If we run out of nodes deep in the tree we don't have enough for toplevel nodes and most of the tree gets discarded.
-> Prune the tree breadth-first instead so only deep nodes get discarded.
tree_copy() stays depth-first, it can't overflow (simpler/faster).
(the old tree_prune() basically)
Other changes:
Don't limit pruned size for small trees, keep everything useful.
Don't bother garbage collecting tree if we don't reuse it anyway (dcnn and no pondering)
Fixes issues where most of the tree gets thrown away in case of temp tree overflow during tree gc. Happened with Lizzie when analyzing sometimes for example.
Until now
tree_prune()
was processing the tree depth-first, but this creates issues in case of overflow: If we run out of nodes deep in the tree we don't have enough for toplevel nodes and most of the tree gets discarded.-> Prune the tree breadth-first instead so only deep nodes get discarded.
tree_copy()
stays depth-first, it can't overflow (simpler/faster). (the oldtree_prune()
basically)Other changes: