MatchedPropertiesCacheItem wastes 388KB of vector capacity on nytimes.com
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Jun 2018 21:15:21 +0000 (21:15 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Jun 2018 21:15:21 +0000 (21:15 +0000)
commit4d69ceeac025cead02725710ab9c257b530cc069
treedc35b1ced881f378e268f6c8f22076d6a06161e5
parenta7c900339665b0204fab4c974cf544cccf01732b
MatchedPropertiesCacheItem wastes 388KB of vector capacity on nytimes.com
https://bugs.webkit.org/show_bug.cgi?id=186990

Reviewed by Antti Koivisto.

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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233173 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h