Tree is too long to expand due to unnecessary sorting
tfrancart opened this issue · comments
Thomas Francart commented
This method https://github.com/lmazuel/onagui/blob/master/src/main/java/fr/onagui/control/MyTreeModel.java#L153 scans all the children of a node to find the corresct index at which to insert a new child. This is called for every new child to be inserted.
The consequence is a N(square) complexity to construct expand a node.
It is much more efficient to insert all children unordered, then sort the children with a sorting algorithm.
Thomas Francart commented
Note : this is necessary to be able to load RAMEAU on which we have 66000+ first-level concepts, and first level of tree cannot be unfolded.