[webkit-changes] [WebKit/WebKit] b94dfa: Deduplicate ImmutableStyleProperties

Antti Koivisto noreply at github.com
Thu Aug 10 11:48:25 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b94dfacbb5ecf3d9e2378224f12a5784c8e068ab
      https://github.com/WebKit/WebKit/commit/b94dfacbb5ecf3d9e2378224f12a5784c8e068ab
  Author: Antti Koivisto <antti at apple.com>
  Date:   2023-08-10 (Thu, 10 Aug 2023)

  Changed paths:
    M Source/WebCore/css/CSSFontFaceSrcValue.cpp
    M Source/WebCore/css/CSSFunctionValue.cpp
    M Source/WebCore/css/CSSFunctionValue.h
    M Source/WebCore/css/CSSPrimitiveValue.cpp
    M Source/WebCore/css/CSSPrimitiveValue.h
    M Source/WebCore/css/CSSValue.cpp
    M Source/WebCore/css/CSSValue.h
    M Source/WebCore/css/CSSValueList.cpp
    M Source/WebCore/css/CSSValueList.h
    M Source/WebCore/css/CSSValuePair.cpp
    M Source/WebCore/css/CSSValuePair.h
    M Source/WebCore/css/ImmutableStyleProperties.cpp
    M Source/WebCore/css/ImmutableStyleProperties.h
    M Source/WebCore/css/StyleProperties.cpp
    M Source/WebCore/css/parser/CSSParserImpl.cpp
    M Source/WebCore/page/MemoryRelease.cpp

  Log Message:
  -----------
  Deduplicate ImmutableStyleProperties
https://bugs.webkit.org/show_bug.cgi?id=259972
rdar://113622930

Reviewed by Alan Baradlay.

It is common for the same style declarations to repeat. On some sites >50% of declarations are duplicates.

This patch add support for hashing simple CSSValues. This mechanism may have
other uses in future too.

* Source/WebCore/css/CSSFontFaceSrcValue.cpp:
(WebCore::CSSFontFaceSrcResourceValue::equals const):

Also fix equality comparison here.

* Source/WebCore/css/CSSFunctionValue.cpp:
(WebCore::CSSFunctionValue::addDerivedHash const):
* Source/WebCore/css/CSSFunctionValue.h:
* Source/WebCore/css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::addDerivedHash const):
* Source/WebCore/css/CSSPrimitiveValue.h:
* Source/WebCore/css/CSSValue.cpp:
(WebCore::CSSValue::visitDerived):
(WebCore::CSSValue::addHash const):
(WebCore::CSSValue::addDerivedHash const):
(WebCore::add):
* Source/WebCore/css/CSSValue.h:
* Source/WebCore/css/CSSValueList.cpp:
(WebCore::CSSValueContainingVector::addDerivedHash const):
* Source/WebCore/css/CSSValueList.h:
* Source/WebCore/css/CSSValuePair.cpp:
(WebCore::CSSValuePair::addDerivedHash const):
* Source/WebCore/css/CSSValuePair.h:
* Source/WebCore/css/ImmutableStyleProperties.cpp:
(WebCore::deduplicationMap):
(WebCore::ImmutableStyleProperties::createDeduplicating):

Deduplicate using a map.

(WebCore::ImmutableStyleProperties::clearDeduplicationMap):
* Source/WebCore/css/ImmutableStyleProperties.h:
* Source/WebCore/css/StyleProperties.cpp:
(WebCore::StyleProperties::immutableCopyIfNeeded const):
* Source/WebCore/css/parser/CSSParserImpl.cpp:
(WebCore::createStyleProperties):
* Source/WebCore/page/MemoryRelease.cpp:
(WebCore::releaseNoncriticalMemory):

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




More information about the webkit-changes mailing list