Bug 251701
Summary: | Style::RuleFeatureSet wastes vector capacity | ||
---|---|---|---|
Product: | WebKit | Reporter: | Simon Fraser (smfr) <simon.fraser> |
Component: | CSS | Assignee: | Antti Koivisto <koivisto> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | koivisto, ntim, simon.fraser, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | WebKit Local Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Simon Fraser (smfr)
Using the patch in bug 186698, and testing on a wikipedia page, we see that RuleFeatureSet::collectFeatures() wastes a 5KB vector capacity:
Wasted capacity: 5472 bytes (used 672 of 6144 bytes, utilization: 10.94%) - 24 allocations
1 0x2fcec0bec WebCore::Style::RuleFeatureSet::collectFeatures(WebCore::Style::RuleData const&)
2 0x2fcec5807 WebCore::Style::RuleSet::addRule(WebCore::Style::RuleData&&, unsigned int, unsigned int)
3 0x2fcec5790 WebCore::Style::RuleSet::addRule(WebCore::StyleRule const&, unsigned int, unsigned int)
4 0x2fcee8922 WTF::Vector<WebCore::Style::InvalidationRuleSet, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>* WebCore::Style::ensureInvalidationRuleSets<WTF::AtomString, WTF::Vector<WebCore::Style::RuleFeature, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>, WTF::DefaultHash<WTF::AtomString>, WTF::HashTraits<WTF::AtomString> >(WTF::AtomString const&, WTF::HashMap<WTF::AtomString, std::__1::unique_ptr<WTF::Vector<WebCore::Style::InvalidationRuleSet, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>, std::__1::default_delete<WTF::Vector<WebCore::Style::InvalidationRuleSet, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc> > >, WTF::DefaultHash<WTF::AtomString>, WTF::HashTraits<WTF::AtomString>, WTF::HashTraits<std::__1::unique_ptr<WTF::Vector<WebCore::Style::InvalidationRuleSet, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>, std::__1::default_delete<WTF::Vector<WebCore::Style::InvalidationRuleSet, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc> > > >, WTF::HashTableTraits>&, WTF::HashMap<WTF::AtomString, std::__1::unique_ptr<WTF::Vector<WebCore::Style::RuleFeature, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>, std::__1::default_delete<WTF::Vector<WebCore::Style::RuleFeature, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc> > >, WTF::DefaultHash<WTF::AtomString>, WTF::HashTraits<WTF::AtomString>, WTF::HashTraits<std::__1::unique_ptr<WTF::Vector<WebCore::Style::RuleFeature, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>, std::__1::default_delete<WTF::Vector<WebCore::Style::RuleFeature, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc> > > >, WTF::HashTableTraits> const&)
5 0x2fceaeb0d WebCore::Style::ClassChangeInvalidation::computeInvalidation(WebCore::SpaceSplitString const&, WebCore::SpaceSplitString const&)
6 0x2fc3955e1 WebCore::Style::ClassChangeInvalidation::ClassChangeInvalidation(WebCore::Element&, WebCore::SpaceSplitString const&, WebCore::SpaceSplitString const&)
7 0x2fc386170 WebCore::Element::classAttributeChanged(WTF::AtomString const&)
8 0x2fc385b17 WebCore::Element::attributeChanged(WebCore::QualifiedName const&, WTF::AtomString const&, WTF::AtomString const&, WebCore::Element::AttributeModificationReason)
9 0x2fc38fe34 WebCore::Element::didModifyAttribute(WebCore::QualifiedName const&, WTF::AtomString const&, WTF::AtomString const&)
10 0x2fc384df3 WebCore::Element::setAttributeInternal(unsigned int, WebCore::QualifiedName const&, WTF::AtomString const&, WebCore::Element::SynchronizationOfLazyAttribute)
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/105011534>
Simon Fraser (smfr)
Maybe need a shrinkToFit() somewhere like ensureInvalidationRuleSets()?
Simon Fraser (smfr)
There's bloat out of these two call sites:
ClassChangeInvalidation::computeInvalidation()
PseudoClassChangeInvalidation::collectRuleSets();
Antti Koivisto
Pull request: https://github.com/WebKit/WebKit/pull/9806
EWS
Committed 260021@main (381f8ae629b0): <https://commits.webkit.org/260021@main>
Reviewed commits have been landed. Closing PR #9806 and removing active labels.
Bri Harris
Re-opening for pull request https://github.com/WebKit/WebKit/pull/9830