Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 047e076765717fc250af0d6b5f5abdd63af0a0cd
      
https://github.com/WebKit/WebKit/commit/047e076765717fc250af0d6b5f5abdd63af0a0cd
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-10-09 (Fri, 09 Oct 2026)

  Changed paths:
    A PerformanceTests/CSS/CSSRemoveShorthandProperty.html
    M Source/WebCore/css/MutableStyleProperties.cpp

  Log Message:
  -----------
  MutableStyleProperties::removeProperties() allocates a HashSet on every call
https://bugs.webkit.org/show_bug.cgi?id=326907
rdar://189568792

Reviewed by Antti Koivisto.

removeProperties() built a temporary HashSet<CSSPropertyID> from its input
span on every call, only to discard it after a single removeAllMatching()
pass. It is called whenever a shorthand is removed or set via CSSOM, and
repeatedly from editing code (EditingStyle, ReplaceSelectionCommand), often
once per node.

Replace it with a stack-allocated WTF::BitSet<cssPropertyIDEnumValueCount>,
matching CSSProperty::colorProperties / physicalProperties. This avoids the
heap allocation and hashing, and keeps membership checks O(1) even for large
inputs like the `all` shorthand, where a linear std::ranges::contains scan
would be quadratic.

This improves PerformanceTests/CSS/CSSRemoveShorthandProperty.html from
203 to 508 runs/s (~2.5x) on an M3 Max machine.

* PerformanceTests/CSS/CSSRemoveShorthandProperty.html: Added.
* Source/WebCore/css/MutableStyleProperties.cpp:
(WebCore::MutableStyleProperties::removeProperties):

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



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

Reply via email to