mirror of
https://github.com/SerenityOS/serenity
synced 2026-05-10 17:12:55 +02: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