In our project, we have a compound node contains more than 17000 nodes, when collapsing it, it takes about 30 seconds. After some investigation, the API expandCollapseUtilities.removeChildren is taking most of the time, it seems like the following code inside the For loop is pretty expensive:
......
var removedChild = child.remove();
if (root._private.data.collapsedChildren == null) {
root._private.data.collapsedChildren = removedChild;
}
else {
root._private.data.collapsedChildren = root._private.data.collapsedChildren.union(removedChild);
}
Instead of doing that, how about to move the code out of the loop and do something:
In our project, we have a compound node contains more than 17000 nodes, when collapsing it, it takes about 30 seconds. After some investigation, the API
expandCollapseUtilities.removeChildren
is taking most of the time, it seems like the following code inside the For loop is pretty expensive:Instead of doing that, how about to move the code out of the loop and do something:
This way needs much less time (drop to about 1 second) to run.