Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b1b65ab7abea9c003935afb7ff84180ec1f71cfe
      
https://github.com/WebKit/WebKit/commit/b1b65ab7abea9c003935afb7ff84180ec1f71cfe
  Author: Antti Koivisto <[email protected]>
  Date:   2025-10-31 (Fri, 31 Oct 2025)

  Changed paths:
    M Source/WebCore/css/CSSSelector.cpp
    M Source/WebCore/css/CSSSelector.h
    M Source/WebCore/css/CSSSelectorList.cpp
    M Source/WebCore/css/CSSSelectorList.h
    M Source/WebCore/style/RuleFeature.cpp
    M Source/WebCore/style/RuleFeature.h
    M Source/WebCore/style/RuleSet.cpp
    M Source/WebCore/style/RuleSet.h
    M Source/WebCore/style/RuleSetBuilder.cpp
    M Source/WebCore/style/RuleSetBuilder.h

  Log Message:
  -----------
  [github perf] Deduplicate RuleFeatures using a hash
https://bugs.webkit.org/show_bug.cgi?id=301748
rdar://163781657

Reviewed by Alan Baradlay.

Use hash instead of a linear search for more effective deduplication.

* Source/WebCore/css/CSSSelector.cpp:
(WebCore::shouldSkipForEqualMode):
(WebCore::complexSelectorsEqual):
(WebCore::addSimpleSelector):
(WebCore::addComplexSelector):

Add a hash function for CSSSelector.

* Source/WebCore/css/CSSSelector.h:
* Source/WebCore/css/CSSSelectorList.cpp:
(WebCore::add):
* Source/WebCore/css/CSSSelectorList.h:
* Source/WebCore/style/RuleFeature.cpp:
(WebCore::Style::addIgnoringPseudoElement):
(WebCore::Style::RuleFeatureDeduplicationKey<RuleFeatureType>::hash const):
(WebCore::Style::= const):
(WebCore::Style::RuleFeatureSet::collectFeatures):

Test if we have added an equivalent feature already.

* Source/WebCore/style/RuleFeature.h:
(WebCore::Style::RuleFeatureDeduplicationKey::Hash::hash):
(WebCore::Style::RuleFeatureDeduplicationKey::Hash::equal):

Add a key type.

(WebCore::Style::RuleFeatureSet::collectFeatures):
* Source/WebCore/style/RuleSet.cpp:
(WebCore::Style::RuleSet::addRule):
* Source/WebCore/style/RuleSet.h:
* Source/WebCore/style/RuleSetBuilder.cpp:
(WebCore::Style::RuleSetBuilder::addStyleRuleWithSelectorList):

Pass a context class that contains the transient deduplication hashes.

* Source/WebCore/style/RuleSetBuilder.h:

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



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

Reply via email to