WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
251701
Style::RuleFeatureSet wastes vector capacity
https://bugs.webkit.org/show_bug.cgi?id=251701
Summary
Style::RuleFeatureSet wastes vector capacity
Simon Fraser (smfr)
Reported
2023-02-03 10:32:30 PST
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
Comment 1
2023-02-03 10:33:07 PST
<
rdar://problem/105011534
>
Simon Fraser (smfr)
Comment 2
2023-02-04 13:59:32 PST
Maybe need a shrinkToFit() somewhere like ensureInvalidationRuleSets()?
Simon Fraser (smfr)
Comment 3
2023-02-04 14:00:21 PST
There's bloat out of these two call sites: ClassChangeInvalidation::computeInvalidation() PseudoClassChangeInvalidation::collectRuleSets();
Antti Koivisto
Comment 4
2023-02-08 02:48:46 PST
Pull request:
https://github.com/WebKit/WebKit/pull/9806
EWS
Comment 5
2023-02-08 10:44:42 PST
Committed
260021@main
(381f8ae629b0): <
https://commits.webkit.org/260021@main
> Reviewed commits have been landed. Closing PR #9806 and removing active labels.
Bri Harris
Comment 6
2023-02-08 11:19:51 PST
Re-opening for pull request
https://github.com/WebKit/WebKit/pull/9830
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug