WebKit Bugzilla
Attachment 343166 Details for
Bug 186701
: AnimationList wastes 60KB of vector capacity
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186701-20180620111449.patch (text/plain), 7.36 KB, created by
Simon Fraser (smfr)
on 2018-06-20 11:14:50 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Simon Fraser (smfr)
Created:
2018-06-20 11:14:50 PDT
Size:
7.36 KB
patch
obsolete
>Subversion Revision: 232900 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 80221903a52ef86da10e0ebb58161ee0f531f87d..2d5e213ff6a7955883735f5b96d47a73b209653f 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2018-06-20 Simon Fraser <simon.fraser@apple.com> >+ >+ AnimationList wastes 60KB of vector capacity >+ https://bugs.webkit.org/show_bug.cgi?id=186701 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ AnimationList was the second most wasteful call site for Vector capacity on theverge.com, >+ wasting almost 60KB. Lists had between 1 and 3 entries, so give AnimationList's vector of >+ Animations a min capacity of zero so it doesn't grow in increments of 16. >+ >+ Also shrink Animation from 88 bytes to 72 bytes by optimizing packing. >+ >+ * platform/animation/Animation.cpp: >+ (WebCore::Animation::Animation): >+ (WebCore::Animation::operator=): >+ (WebCore::Animation::animationsMatch const): >+ * platform/animation/Animation.h: >+ (WebCore::Animation::animationMode const): >+ (WebCore::Animation::setAnimationMode): >+ * platform/animation/AnimationList.h: >+ > 2018-06-15 Chris Dumez <cdumez@apple.com> > > StyleRuleMedia wastes 158KB of Vector capacity on cnn.com >diff --git a/Source/WebCore/platform/animation/Animation.cpp b/Source/WebCore/platform/animation/Animation.cpp >index 10fcf885e9db38b363eeed8b680023a314d5ff3d..ac7d27a391648139f99e67c105aa27e61224c0c1 100644 >--- a/Source/WebCore/platform/animation/Animation.cpp >+++ b/Source/WebCore/platform/animation/Animation.cpp >@@ -28,8 +28,6 @@ namespace WebCore { > > Animation::Animation() > : m_name(initialName()) >- , m_property(CSSPropertyInvalid) >- , m_mode(AnimateAll) > , m_iterationCount(initialIterationCount()) > , m_delay(initialDelay()) > , m_duration(initialDuration()) >@@ -37,6 +35,7 @@ Animation::Animation() > #if ENABLE(CSS_ANIMATIONS_LEVEL_2) > , m_trigger(initialTrigger()) > #endif >+ , m_mode(AnimateAll) > , m_direction(initialDirection()) > , m_fillMode(static_cast<unsigned>(initialFillMode())) > , m_playState(static_cast<unsigned>(initialPlayState())) >@@ -58,10 +57,8 @@ Animation::Animation() > > Animation::Animation(const Animation& o) > : RefCounted<Animation>() >- , m_name(o.m_name) >- , m_nameStyleScopeOrdinal(o.m_nameStyleScopeOrdinal) > , m_property(o.m_property) >- , m_mode(o.m_mode) >+ , m_name(o.m_name) > , m_iterationCount(o.m_iterationCount) > , m_delay(o.m_delay) > , m_duration(o.m_duration) >@@ -69,6 +66,8 @@ Animation::Animation(const Animation& o) > #if ENABLE(CSS_ANIMATIONS_LEVEL_2) > , m_trigger(o.m_trigger) > #endif >+ , m_nameStyleScopeOrdinal(o.m_nameStyleScopeOrdinal) >+ , m_mode(o.m_mode) > , m_direction(o.m_direction) > , m_fillMode(o.m_fillMode) > , m_playState(o.m_playState) >@@ -91,9 +90,6 @@ Animation::Animation(const Animation& o) > Animation& Animation::operator=(const Animation& o) > { > m_name = o.m_name; >- m_nameStyleScopeOrdinal = o.m_nameStyleScopeOrdinal; >- m_property = o.m_property; >- m_mode = o.m_mode; > m_iterationCount = o.m_iterationCount; > m_delay = o.m_delay; > m_duration = o.m_duration; >@@ -101,6 +97,9 @@ Animation& Animation::operator=(const Animation& o) > #if ENABLE(CSS_ANIMATIONS_LEVEL_2) > m_trigger = o.m_trigger; > #endif >+ m_nameStyleScopeOrdinal = o.m_nameStyleScopeOrdinal; >+ m_property = o.m_property; >+ m_mode = o.m_mode; > m_direction = o.m_direction; > m_fillMode = o.m_fillMode; > m_playState = o.m_playState; >@@ -130,7 +129,6 @@ Animation::~Animation() = default; > bool Animation::animationsMatch(const Animation& other, bool matchProperties) const > { > bool result = m_name == other.m_name >- && m_nameStyleScopeOrdinal == other.m_nameStyleScopeOrdinal > && m_playState == other.m_playState > && m_playStateSet == other.m_playStateSet > && m_iterationCount == other.m_iterationCount >@@ -140,6 +138,7 @@ bool Animation::animationsMatch(const Animation& other, bool matchProperties) co > #if ENABLE(CSS_ANIMATIONS_LEVEL_2) > && *(m_trigger.get()) == *(other.m_trigger.get()) > #endif >+ && m_nameStyleScopeOrdinal == other.m_nameStyleScopeOrdinal > && m_direction == other.m_direction > && m_fillMode == other.m_fillMode > && m_delaySet == other.m_delaySet >diff --git a/Source/WebCore/platform/animation/Animation.h b/Source/WebCore/platform/animation/Animation.h >index fa4b4cbe849ac94b8577e1b70be4ada80eecc861..f406e7ffd4155909a07f17a6538530d40b2428ed 100644 >--- a/Source/WebCore/platform/animation/Animation.h >+++ b/Source/WebCore/platform/animation/Animation.h >@@ -138,7 +138,7 @@ public: > CSSPropertyID property() const { return m_property; } > const String& unknownProperty() const { return m_unknownProperty; } > TimingFunction* timingFunction() const { return m_timingFunction.get(); } >- AnimationMode animationMode() const { return m_mode; } >+ AnimationMode animationMode() const { return static_cast<AnimationMode>(m_mode); } > #if ENABLE(CSS_ANIMATIONS_LEVEL_2) > AnimationTrigger* trigger() const { return m_trigger.get(); } > #endif >@@ -158,7 +158,7 @@ public: > void setProperty(CSSPropertyID t) { m_property = t; m_propertySet = true; } > void setUnknownProperty(const String& property) { m_unknownProperty = property; } > void setTimingFunction(RefPtr<TimingFunction>&& function) { m_timingFunction = WTFMove(function); m_timingFunctionSet = true; } >- void setAnimationMode(AnimationMode mode) { m_mode = mode; } >+ void setAnimationMode(AnimationMode mode) { m_mode = static_cast<unsigned>(mode); } > #if ENABLE(CSS_ANIMATIONS_LEVEL_2) > void setTrigger(RefPtr<AnimationTrigger>&& trigger) { m_trigger = WTFMove(trigger); m_triggerSet = true; } > #endif >@@ -181,11 +181,11 @@ private: > WEBCORE_EXPORT Animation(); > Animation(const Animation& o); > >+ // Packs with m_refCount from the base class. >+ CSSPropertyID m_property { CSSPropertyInvalid }; >+ > String m_name; >- Style::ScopeOrdinal m_nameStyleScopeOrdinal { Style::ScopeOrdinal::Element }; >- CSSPropertyID m_property; > String m_unknownProperty; >- AnimationMode m_mode; > double m_iterationCount; > double m_delay; > double m_duration; >@@ -193,11 +193,13 @@ private: > #if ENABLE(CSS_ANIMATIONS_LEVEL_2) > RefPtr<AnimationTrigger> m_trigger; > #endif >- unsigned m_direction : 2; // AnimationDirection >- unsigned m_fillMode : 2; > >+ Style::ScopeOrdinal m_nameStyleScopeOrdinal { Style::ScopeOrdinal::Element }; > >- unsigned m_playState : 2; >+ unsigned m_mode : 2; // AnimationMode >+ unsigned m_direction : 2; // AnimationDirection >+ unsigned m_fillMode : 2; // AnimationFillMode >+ unsigned m_playState : 2; // AnimationPlayState > > bool m_delaySet : 1; > bool m_directionSet : 1; >diff --git a/Source/WebCore/platform/animation/AnimationList.h b/Source/WebCore/platform/animation/AnimationList.h >index ab76209926bf953b51ff996b2be8e8ba7aced787..66d9477f7e8849cd83e5d9bdfb75b71131346e24 100644 >--- a/Source/WebCore/platform/animation/AnimationList.h >+++ b/Source/WebCore/platform/animation/AnimationList.h >@@ -57,7 +57,7 @@ private: > AnimationList& operator=(const AnimationList&); > AnimationList& operator=(AnimationList&&) = default; > >- Vector<Ref<Animation>> m_animations; >+ Vector<Ref<Animation>, 0, CrashOnOverflow, 0> m_animations; > }; > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186701
: 343166 |
343176