Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 09f6a02b04a433e6006675390914d4876e27aef5
      
https://github.com/WebKit/WebKit/commit/09f6a02b04a433e6006675390914d4876e27aef5
  Author: Chris Dumez <[email protected]>
  Date:   2026-04-01 (Wed, 01 Apr 2026)

  Changed paths:
    M Source/WebCore/css/CSSSelector.cpp

  Log Message:
  -----------
  Avoid heap allocation in CSSSelector::visitSimpleSelectors()
https://bugs.webkit.org/show_bug.cgi?id=311260

Reviewed by Darin Adler and Sam Weinig.

Replace std::queue (backed by std::deque, which heap-allocates) with
a Deque<..., 16> with inline capacity of 16 to preserve BFS traversal
order while avoiding heap allocation for typical selector trees. I have
verified that this avoids heap allocation on Speedometer 3.

Also remove an unnecessary const_cast — the VisitFunctor already takes
`const CSSSelector&`.

* Source/WebCore/css/CSSSelector.cpp:
(WebCore::CSSSelector::visitSimpleSelectors const):

Canonical link: https://commits.webkit.org/310411@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to