mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-11 01:22:43 +02:00
Element::matches() and Element::closest() were re-parsing the selector string on every call. The document already maintains a parsed-selector cache for querySelector/querySelectorAll. This patch folds that cache's lookup, parse, namespace filtering and insertion behind a Document::parse_or_cache_selector_list(string) and calls it from all four entry points. We also bump the cache's limit to get more hits. Saves 100ms of main thread time when loading the "insights" view on our GitHub repo on my Linux machine. :^)
12 KiB
12 KiB