WebKit Bugzilla
Attachment 343485 Details for
Bug 186990
: MatchedPropertiesCacheItem wastes 388KB of vector capacity on nytimes.com
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186990-20180624225124.patch (text/plain), 3.35 KB, created by
Simon Fraser (smfr)
on 2018-06-24 22:51:24 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Simon Fraser (smfr)
Created:
2018-06-24 22:51:24 PDT
Size:
3.35 KB
patch
obsolete
>Subversion Revision: 233132 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 8ffb021ad5f848e06fb7849c0c980d8f46447b21..7e239c581a2876b3ce140210a363dbc308978d83 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,19 @@ >+2018-06-24 Simon Fraser <simon.fraser@apple.com> >+ >+ MatchedPropertiesCacheItem wastes 388KB of vector capacity on nytimes.com >+ https://bugs.webkit.org/show_bug.cgi?id=186990 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ MatchedPropertiesCacheItem.matchedProperties was appended to, so it allocated capacity >+ in 16-size chunks. Instead, assign to it so it only allocates as much capacity as is needed. >+ Copy-constructing is more wasteful, since it copies the 64-chunk size from the right-hand side. >+ >+ * css/StyleResolver.cpp: >+ (WebCore::StyleResolver::addToMatchedPropertiesCache): >+ * css/StyleResolver.h: >+ (WebCore::StyleResolver::MatchedPropertiesCacheItem::MatchedPropertiesCacheItem): >+ > 2018-06-23 Zalan Bujtas <zalan@apple.com> > > [Mail] Use the Mail Viewer width as the base for resolving horizontal viewport units >diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp >index ad59facf12d359ccde96996e369997b323ac43a2..4da509251aaa7f866976a7ae6206f2cbf1758397 100644 >--- a/Source/WebCore/css/StyleResolver.cpp >+++ b/Source/WebCore/css/StyleResolver.cpp >@@ -1251,13 +1251,9 @@ void StyleResolver::addToMatchedPropertiesCache(const RenderStyle* style, const > } > > ASSERT(hash); >- MatchedPropertiesCacheItem cacheItem; >- cacheItem.matchedProperties.appendVector(matchResult.matchedProperties()); >- cacheItem.ranges = matchResult.ranges; > // Note that we don't cache the original RenderStyle instance. It may be further modified. > // The RenderStyle in the cache is really just a holder for the substructures and never used as-is. >- cacheItem.renderStyle = RenderStyle::clonePtr(*style); >- cacheItem.parentRenderStyle = RenderStyle::clonePtr(*parentStyle); >+ MatchedPropertiesCacheItem cacheItem(matchResult, style, parentStyle); > m_matchedPropertiesCache.add(hash, WTFMove(cacheItem)); > } > >diff --git a/Source/WebCore/css/StyleResolver.h b/Source/WebCore/css/StyleResolver.h >index 0f2f3fe7a9d09d7ff90deb1487a4e71b4a55cbe7..0e83c0eb02a7d8a6cd6f03830c2c52a19511beab 100644 >--- a/Source/WebCore/css/StyleResolver.h >+++ b/Source/WebCore/css/StyleResolver.h >@@ -468,6 +468,16 @@ private: > MatchRanges ranges; > std::unique_ptr<RenderStyle> renderStyle; > std::unique_ptr<RenderStyle> parentRenderStyle; >+ >+ MatchedPropertiesCacheItem(const MatchResult& matchResult, const RenderStyle* style, const RenderStyle* parentStyle) >+ : ranges(matchResult.ranges) >+ , renderStyle(RenderStyle::clonePtr(*style)) >+ , parentRenderStyle(RenderStyle::clonePtr(*parentStyle)) >+ { >+ // Assign rather than copy-construct so we only allocate as much vector capacity as needed. >+ matchedProperties = matchResult.matchedProperties(); >+ } >+ MatchedPropertiesCacheItem() = default; > }; > const MatchedPropertiesCacheItem* findFromMatchedPropertiesCache(unsigned hash, const MatchResult&); > void addToMatchedPropertiesCache(const RenderStyle*, const RenderStyle* parentStyle, unsigned hash, const MatchResult&);
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 186990
: 343485