LibWeb: Cache the result of Selector::specificity()

This function was showing up as taking 30% of all runtime during a
profile of Browser. This change effectively eliminates it completely.
This commit is contained in:
Idan Horowitz 2022-02-05 17:40:18 +02:00 committed by Andreas Kling
commit 89bd4cd80d
Notes: sideshowbarker 2024-07-17 19:46:28 +09:00
2 changed files with 7 additions and 1 deletions

View file

@ -138,6 +138,7 @@ private:
explicit Selector(Vector<CompoundSelector>&&);
Vector<CompoundSelector> m_compound_selectors;
mutable Optional<u32> m_specificity;
};
constexpr StringView pseudo_element_name(Selector::SimpleSelector::PseudoElement);