Title: [256102] trunk/Source/WebCore
- Revision
- 256102
- Author
- [email protected]
- Date
- 2020-02-09 09:57:04 -0800 (Sun, 09 Feb 2020)
Log Message
Optimize Style::determineChange()
https://bugs.webkit.org/show_bug.cgi?id=207438
Reviewed by Antti Koivisto.
Style::determineChange() called RenderStyle::operator!=() before the testing some other
sets of properties for inequality.
It's faster to call inheritedEqual() etc before the full style compare. Also optimize
comparing alignItems() and justifyItems() by adding a helper function that first tests
for equality of the m_rareNonInheritedData pointer. These (added in r213480) return Inherit
because align-items and justify-items affect child layout.
This is a ~4% progression on some MotionMark subtests. Time under TreeResolver::createAnimatedElementUpdate()
drops from 2.4% to 0.9%.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::descendantAffectingNonInheritedPropertiesEqual const):
* rendering/style/RenderStyle.h:
* style/StyleChange.cpp:
(WebCore::Style::determineChange):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (256101 => 256102)
--- trunk/Source/WebCore/ChangeLog 2020-02-09 17:46:04 UTC (rev 256101)
+++ trunk/Source/WebCore/ChangeLog 2020-02-09 17:57:04 UTC (rev 256102)
@@ -1,3 +1,27 @@
+2020-02-08 Simon Fraser <[email protected]>
+
+ Optimize Style::determineChange()
+ https://bugs.webkit.org/show_bug.cgi?id=207438
+
+ Reviewed by Antti Koivisto.
+
+ Style::determineChange() called RenderStyle::operator!=() before the testing some other
+ sets of properties for inequality.
+
+ It's faster to call inheritedEqual() etc before the full style compare. Also optimize
+ comparing alignItems() and justifyItems() by adding a helper function that first tests
+ for equality of the m_rareNonInheritedData pointer. These (added in r213480) return Inherit
+ because align-items and justify-items affect child layout.
+
+ This is a ~4% progression on some MotionMark subtests. Time under TreeResolver::createAnimatedElementUpdate()
+ drops from 2.4% to 0.9%.
+
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::descendantAffectingNonInheritedPropertiesEqual const):
+ * rendering/style/RenderStyle.h:
+ * style/StyleChange.cpp:
+ (WebCore::Style::determineChange):
+
2020-02-09 Zalan Bujtas <[email protected]>
[LFC] FloatingContext::constraints should take a vertical range instead of just vertical position.
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (256101 => 256102)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2020-02-09 17:46:04 UTC (rev 256101)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2020-02-09 17:57:04 UTC (rev 256102)
@@ -438,6 +438,15 @@
&& m_rareInheritedData == other.m_rareInheritedData;
}
+bool RenderStyle::descendantAffectingNonInheritedPropertiesEqual(const RenderStyle& other) const
+{
+ if (m_rareNonInheritedData.ptr() == other.m_rareNonInheritedData.ptr())
+ return true;
+
+ return m_rareNonInheritedData->alignItems == other.m_rareNonInheritedData->alignItems
+ && m_rareNonInheritedData->justifyItems == other.m_rareNonInheritedData->justifyItems;
+}
+
#if ENABLE(TEXT_AUTOSIZING)
static inline unsigned computeFontHash(const FontCascade& font)
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (256101 => 256102)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2020-02-09 17:46:04 UTC (rev 256101)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2020-02-09 17:57:04 UTC (rev 256102)
@@ -1418,6 +1418,7 @@
const AtomString& hyphenString() const;
bool inheritedEqual(const RenderStyle&) const;
+ bool descendantAffectingNonInheritedPropertiesEqual(const RenderStyle&) const;
#if ENABLE(TEXT_AUTOSIZING)
uint32_t hashForTextAutosizing() const;
Modified: trunk/Source/WebCore/style/StyleChange.cpp (256101 => 256102)
--- trunk/Source/WebCore/style/StyleChange.cpp 2020-02-09 17:46:04 UTC (rev 256101)
+++ trunk/Source/WebCore/style/StyleChange.cpp 2020-02-09 17:57:04 UTC (rev 256102)
@@ -49,15 +49,14 @@
if (s1.hasTextCombine() != s2.hasTextCombine())
return Detach;
- if (s1 != s2) {
- if (!s1.inheritedEqual(s2))
- return Inherit;
+ if (!s1.inheritedEqual(s2))
+ return Inherit;
- if (s1.alignItems() != s2.alignItems() || s1.justifyItems() != s2.justifyItems())
- return Inherit;
+ if (!s1.descendantAffectingNonInheritedPropertiesEqual(s2))
+ return Inherit;
+ if (s1 != s2)
return NoInherit;
- }
// If the pseudoStyles have changed, we want any StyleChange that is not NoChange
// because setStyle will do the right thing with anything else.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes