Bug 207438 - Optimize Style::determineChange()
Summary: Optimize Style::determineChange()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-02-08 21:15 PST by Simon Fraser (smfr)
Modified: 2020-02-09 20:12 PST (History)
11 users (show)

See Also:


Attachments
Patch (4.13 KB, patch)
2020-02-08 21:19 PST, Simon Fraser (smfr)
koivisto: review+
Details | Formatted Diff | Diff
Patch (4.01 KB, patch)
2020-02-09 08:19 PST, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2020-02-08 21:15:54 PST
Optimize Style::determineChange()
Comment 1 Simon Fraser (smfr) 2020-02-08 21:19:52 PST
Created attachment 390194 [details]
Patch
Comment 2 Antti Koivisto 2020-02-09 05:50:31 PST
Comment on attachment 390194 [details]
Patch

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

> Source/WebCore/rendering/style/RenderStyle.cpp:451
> +bool RenderStyle::alignItemsEqual(const RenderStyle& other) const
> +{
> +    return m_rareNonInheritedData.ptr() == other.m_rareNonInheritedData.ptr()
> +        || m_rareNonInheritedData->alignItems == other.m_rareNonInheritedData->alignItems;
> +}
> +
> +bool RenderStyle::justifyItemsEqual(const RenderStyle& other) const
> +{
> +    return m_rareNonInheritedData.ptr() == other.m_rareNonInheritedData.ptr()
> +        || m_rareNonInheritedData->justifyItems == other.m_rareNonInheritedData->justifyItems;
> +}

Combining these ("alignAndJustifyItemsEqual") would eliminate one m_rareNonInheritedData comparison.
Comment 3 Simon Fraser (smfr) 2020-02-09 07:51:52 PST
(In reply to Antti Koivisto from comment #2)
> Comment on attachment 390194 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=390194&action=review
> 
> > Source/WebCore/rendering/style/RenderStyle.cpp:451
> > +bool RenderStyle::alignItemsEqual(const RenderStyle& other) const
> > +{
> > +    return m_rareNonInheritedData.ptr() == other.m_rareNonInheritedData.ptr()
> > +        || m_rareNonInheritedData->alignItems == other.m_rareNonInheritedData->alignItems;
> > +}
> > +
> > +bool RenderStyle::justifyItemsEqual(const RenderStyle& other) const
> > +{
> > +    return m_rareNonInheritedData.ptr() == other.m_rareNonInheritedData.ptr()
> > +        || m_rareNonInheritedData->justifyItems == other.m_rareNonInheritedData->justifyItems;
> > +}
> 
> Combining these ("alignAndJustifyItemsEqual") would eliminate one
> m_rareNonInheritedData comparison.

I thought about that. Wasn't sure what to name the function.
Comment 4 Simon Fraser (smfr) 2020-02-09 08:19:29 PST
Created attachment 390204 [details]
Patch
Comment 5 Antti Koivisto 2020-02-09 09:24:23 PST
Comment on attachment 390204 [details]
Patch

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

> Source/WebCore/style/StyleChange.cpp:56
> +    if (!s1.childAffectingFlexPropertiesEqual(s2))
> +        return Inherit;

Seems like this also affects grid.

Could also be something more generic like descendantStyleAffectingNonInheritedPropertiesEqual
Comment 6 Simon Fraser (smfr) 2020-02-09 20:11:10 PST
https://trac.webkit.org/changeset/256102/webkit
Comment 7 Radar WebKit Bug Importer 2020-02-09 20:12:13 PST
<rdar://problem/59300384>