mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 11:20:03 +00:00
Currently, each time parent_index() is invoked, two depth-first searches are incurred to find the node's parent and grandparent. This becomes particularly expensive, for example, when trying to scroll through a large <ul> list. Instead, upon creation, traverse the DOM JSON and create a map of child nodes to their parent. Then those two lookups become hash map lookups rather than a DFS traversal.
5.3 KiB
5.3 KiB