[webkit-reviews] review granted: [Bug 216241] Comparing styles with large but identical custom property maps is slow : [Attachment 408181] patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 7 10:20:03 PDT 2020


Darin Adler <darin at apple.com> has granted Antti Koivisto <koivisto at iki.fi>'s
request for review:
Bug 216241: Comparing styles with large but identical custom property maps is
slow
https://bugs.webkit.org/show_bug.cgi?id=216241

Attachment 408181: patch

https://bugs.webkit.org/attachment.cgi?id=408181&action=review




--- Comment #3 from Darin Adler <darin at apple.com> ---
Comment on attachment 408181
  --> https://bugs.webkit.org/attachment.cgi?id=408181
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=408181&action=review

> Source/WebCore/ChangeLog:18
> +	   Going to full screen and back on youtube, this patch reduces time in
the longest style update from ~460ms to ~90ms.

Amazing.

> Source/WebCore/rendering/style/RenderStyle.cpp:2337
> +    if (m_rareInheritedData->customProperties.ptr() ==
other.m_rareInheritedData->customProperties.ptr())
> +	   return;
> +    if (*m_rareInheritedData->customProperties ==
*other.m_rareInheritedData->customProperties)
> +	  
const_cast<StyleRareInheritedData&>(m_rareInheritedData.get()).customProperties
= other.m_rareInheritedData->customProperties;

Here’s another way to write it that I like slightly better:

    auto& properties =
const_cast<StyleRareInheritedData&>(m_rareInheritedData->customProperties);
    auto& otherProperties = other.m_rareInheritedData->customProperties;
    if (properties.ptr() != otherProperties.ptr() && *properties ==
*otherProperties)
	priorities = otherProperties;

Not sure you will prefer it.

> Source/WebCore/style/StyleBuilder.cpp:196
> +	   Ref<CSSCustomPropertyValue> valueToApply =
downcast<CSSCustomPropertyValue>(*property.cssValue[index]);

Could we use auto and makeRef here?

> Source/WebCore/style/StyleBuilder.cpp:233
> +	   Ref<CSSCustomPropertyValue> valueToApply =
downcast<CSSCustomPropertyValue>(*property.cssValue[index]);

Could we use auto and makeRef here?


More information about the webkit-reviews mailing list