mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:07:36 +00:00
LibWeb: Cache CSS::Selector's pseudo element at construction time
Computing the pseudo element of a CSS::Selector was very hot when mousing around on GitHub in Browser. A profile had it at ~10%. After these changes, it's totally gone from the profile. :^)
This commit is contained in:
parent
f5c2e87965
commit
f88d65d9cb
2 changed files with 12 additions and 14 deletions
|
@ -135,7 +135,7 @@ public:
|
|||
~Selector();
|
||||
|
||||
Vector<CompoundSelector> const& compound_selectors() const { return m_compound_selectors; }
|
||||
Optional<PseudoElement> pseudo_element() const;
|
||||
Optional<PseudoElement> pseudo_element() const { return m_pseudo_element; }
|
||||
u32 specificity() const;
|
||||
String serialize() const;
|
||||
|
||||
|
@ -144,6 +144,7 @@ private:
|
|||
|
||||
Vector<CompoundSelector> m_compound_selectors;
|
||||
mutable Optional<u32> m_specificity;
|
||||
Optional<Selector::PseudoElement> m_pseudo_element;
|
||||
};
|
||||
|
||||
constexpr StringView pseudo_element_name(Selector::PseudoElement pseudo_element)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue