devtools
devtools copied to clipboard
Inspector tree is traversed more times than necessary
There are two methods that traverse the inspector tree:
- childrenCount - this method traverses the tree once to count all the nodes
- getRowIndex - this method traverses the tree until it reaches the given node. When the tree is initially built, this method is called on every single node 😬 (although the results are cached)
Ideally these two methods could be combined, so that we don't have to modify our tree traversal logic in two places. Furthermore, on initial load of the tree we should build all rows in a single traversal of the tree, instead of traversing it n times.
Further optimizations:
- When a node is marked as
dirty(e.g., it has been expanded or collapsed), we should rebuild only the rows in that node's branch instead of the entire tree. Because currently multiple nodes are marked asdirtyfor a single update, we will need to be careful to not rebuild more times than necessary.