Closed Tuhis closed 6 years ago
Hello @Tuhis. That's weird. I seem to recall that I had a map of the monkeys in the tree so that I could avoid walking the tree when it's not needed. But I guess this is not the case, as your measurements show.
This said, I am open to a PR adding an option to forbid monkeys in a Baobab instance for performance reasons.
Weird indeed. If I understood the code correctly, we walk the tree on every update from the updated point onward (except on unset operation). Anyhow, I submitted a simple PR for disabling monkey evaluation. Hopefully you have some time to review it :)
v2.5.0
is now on npm with your addition. Thansk @Tuhis.
Hi,
Adding an option to disable monkeys would add significant performance boost when operating with large trees without monkeys. Currently, during each update the whole updated branch is traversed through in order to find and update monkeys.
I did some performance measurements which showed that a single update took 210ms, of which over 120ms were wasted walking the tree and trying to find monkeys. About 70ms went to freeze and rest for all other stuff.
Br, Tuhis