Make flat tree traversal faster
Current implementation of flat tree traversal is not cheap when traversing host's children. See http://crbug.com/906494 for details. There was an attempt to make it faster in v1, https://crrev.com/c/1328622, however, this idea was already implemented in v0, and this attempt actually caused a perf regression in some cases (https://crbug.com/905197). This CL makes flat tree traversal for host's children much faster in a different approach. The basic idea is: 1. Let NodeRareData has additional pointers, as FlatTreeNodeData, and set pointers at the timing of slot assignment recalc. 2. At flat tree traversal, use these pointers to skip hashmap lookup. In this CL, |next| and |previous| pointers for assigned nodes are used in flat tree traversal. Thanks to that, flat tree traversal no longer lookup node-to-index hashmap, nor do a liner search there. These additional pointers are only set for host's children. There shouldn't be additional cost for other cases. In a follow-up CL, I'll use FlatTreeNodeData's |assigned_slot| to make flat tree traversal and other operations much faster again. Since this task might be complicated, that can be done in another CL. BUG: 906494 Change-Id: I617da70371d6733050b7dc754d3b40c88c090c79 Reviewed-on: https://chromium-review.googlesource.com/c/1337225 Commit-Queue: Hayato Ito <hayato@chromium.org> Reviewed-by:Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/master@{#609212}
Showing
Please register or sign in to comment