Bug 186742 - TreeScopeOrderedMap wastes 132KB of HashTable capacity on nytimes.com
Summary: TreeScopeOrderedMap wastes 132KB of HashTable capacity on nytimes.com
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-06-16 12:43 PDT by Simon Fraser (smfr)
Modified: 2018-07-03 14:30 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2018-06-16 12:43:26 PDT
Using tooling from bug 186698, loading nytimes.com and running "notifyutil -p com.apple.WebKit.dumpHashTableCapacity" shows:

Wasted capacity: 131912 bytes (used 65208 of 197120 bytes, utilization: 33.08%) - 80 allocations
1   0x1078997a5 WTF::HashTable<WTF::AtomicStringImpl const*, WTF::KeyValuePair<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry>, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry> >, WTF::PtrHash<WTF::AtomicStringImpl const*>, WTF::HashMap<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry, WTF::PtrHash<WTF::AtomicStringImpl const*>, WTF::HashTraits<WTF::AtomicStringImpl const*>, WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry> >::KeyValuePairTraits, WTF::HashTraits<WTF::AtomicStringImpl const*> >::HashTable()
2   0x107899785 WTF::HashMap<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry, WTF::PtrHash<WTF::AtomicStringImpl const*>, WTF::HashTraits<WTF::AtomicStringImpl const*>, WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry> >::HashMap()
3   0x107899765 WTF::HashMap<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry, WTF::PtrHash<WTF::AtomicStringImpl const*>, WTF::HashTraits<WTF::AtomicStringImpl const*>, WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry> >::HashMap()
4   0x107899745 WebCore::TreeScopeOrderedMap::TreeScopeOrderedMap()
5   0x107899725 WebCore::TreeScopeOrderedMap::TreeScopeOrderedMap()
6   0x10788e206 WebCore::TreeScope::addElementById(WTF::AtomicStringImpl const&, WebCore::Element&, bool)
7   0x1077630f8 WebCore::Element::updateIdForTreeScope(WebCore::TreeScope&, WTF::AtomicString const&, WTF::AtomicString const&, WebCore::Element::NotifyObservers)
8   0x107762cd2 WebCore::Element::insertedIntoAncestor(WebCore::Node::InsertionType, WebCore::ContainerNode&)
Comment 1 Radar WebKit Bug Importer 2018-06-16 12:43:54 PDT
<rdar://problem/41189300>
Comment 2 Simon Fraser (smfr) 2018-06-16 12:45:11 PDT
Also these call sites:

Wasted capacity: 70928 bytes (used 11440 of 82368 bytes, utilization: 13.89%) - 1273 allocations
1   0x1076fd625 WTF::HashTable<WebCore::Element*, WebCore::Element*, WTF::IdentityExtractor, WTF::PtrHash<WebCore::Element*>, WTF::HashTraits<WebCore::Element*>, WTF::HashTraits<WebCore::Element*> >::HashTable()
2   0x1076fd605 WTF::HashSet<WebCore::Element*, WTF::PtrHash<WebCore::Element*>, WTF::HashTraits<WebCore::Element*> >::HashSet()
3   0x1076a8d65 WTF::HashSet<WebCore::Element*, WTF::PtrHash<WebCore::Element*>, WTF::HashTraits<WebCore::Element*> >::HashSet()
4   0x10789c652 WebCore::TreeScopeOrderedMap::MapEntry::MapEntry(WebCore::Element*)
5   0x10789c5fd WebCore::TreeScopeOrderedMap::MapEntry::MapEntry(WebCore::Element*)
6   0x10789c0cf WebCore::TreeScopeOrderedMap::add(WTF::AtomicStringImpl const&, WebCore::Element&, WebCore::TreeScope const&)::$_0::operator()() const
7   0x10789afd5 void WTF::HashMapEnsureTranslator<WTF::HashMap<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry, WTF::PtrHash<WTF::AtomicStringImpl const*>, WTF::HashTraits<WTF::AtomicStringImpl const*>, WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry> >::KeyValuePairTraits, WTF::PtrHash<WTF::AtomicStringImpl const*> >::translate<WTF::KeyValuePair<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry>, WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::add(WTF::AtomicStringImpl const&, WebCore::Element&, WebCore::TreeScope const&)::$_0>(WTF::KeyValuePair<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry>&, WTF::AtomicStringImpl const*&&, WebCore::TreeScopeOrderedMap::add(WTF::AtomicStringImpl const&, WebCore::Element&, WebCore::TreeScope const&)::$_0&&)
8   0x10789ac73 WTF::HashTableAddResult<WTF::HashTableIterator<WTF::AtomicStringImpl const*, WTF::KeyValuePair<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry>, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry> >, WTF::PtrHash<WTF::AtomicStringImpl const*>, WTF::HashMap<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry, WTF::PtrHash<WTF::AtomicStringImpl const*>, WTF::HashTraits<WTF::AtomicStringImpl const*>, WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry> >::KeyValuePairTraits, WTF::HashTraits<WTF::AtomicStringImpl const*> > > WTF::HashTable<WTF::AtomicStringImpl const*, WTF::KeyValuePair<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry>, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry> >, WTF::PtrHash<WTF::AtomicStringImpl const*>, WTF::HashMap<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry, WTF::PtrHash<WTF::AtomicStringImpl const*>, WTF::HashTraits<WTF::AtomicStringImpl const*>, WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry> >::KeyValuePairTraits, WTF::HashTraits<WTF::AtomicStringImpl const*> >::add<WTF::HashMapEnsureTranslator<WTF::HashMap<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry, WTF::PtrHash<WTF::AtomicStringImpl const*>, WTF::HashTraits<WTF::AtomicStringImpl const*>, WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry> >::KeyValuePairTraits, WTF::PtrHash<WTF::AtomicStringImpl const*> >, WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::add(WTF::AtomicStringImpl const&, WebCore::Element&, WebCore::TreeScope const&)::$_0>(WTF::AtomicStringImpl const*&&, WebCore::TreeScopeOrderedMap::add(WTF::AtomicStringImpl const&, WebCore::Element&, WebCore::TreeScope const&)::$_0&&)

Wasted capacity: 63448 bytes (used 42856 of 106304 bytes, utilization: 40.31%) - 22 allocations
1   0x1078997a5 WTF::HashTable<WTF::AtomicStringImpl const*, WTF::KeyValuePair<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry>, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry> >, WTF::PtrHash<WTF::AtomicStringImpl const*>, WTF::HashMap<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry, WTF::PtrHash<WTF::AtomicStringImpl const*>, WTF::HashTraits<WTF::AtomicStringImpl const*>, WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry> >::KeyValuePairTraits, WTF::HashTraits<WTF::AtomicStringImpl const*> >::HashTable()
2   0x107899785 WTF::HashMap<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry, WTF::PtrHash<WTF::AtomicStringImpl const*>, WTF::HashTraits<WTF::AtomicStringImpl const*>, WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry> >::HashMap()
3   0x107899765 WTF::HashMap<WTF::AtomicStringImpl const*, WebCore::TreeScopeOrderedMap::MapEntry, WTF::PtrHash<WTF::AtomicStringImpl const*>, WTF::HashTraits<WTF::AtomicStringImpl const*>, WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry> >::HashMap()
4   0x107899745 WebCore::TreeScopeOrderedMap::TreeScopeOrderedMap()
5   0x107899725 WebCore::TreeScopeOrderedMap::TreeScopeOrderedMap()
6   0x107a54296 WebCore::HTMLDocument::HTMLDocument(WebCore::Frame*, WebCore::URL const&, unsigned char, unsigned int)
7   0x107a54358 WebCore::HTMLDocument::HTMLDocument(WebCore::Frame*, WebCore::URL const&, unsigned char, unsigned int)
8   0x10768a2a7 WebCore::HTMLDocument::create(WebCore::Frame*, WebCore::URL const&)
Comment 3 Chris Dumez 2018-07-03 14:30:53 PDT
(In reply to Simon Fraser (smfr) from comment #2)
> Also these call sites:
> 
> Wasted capacity: 70928 bytes (used 11440 of 82368 bytes, utilization:
> 13.89%) - 1273 allocations
> 1   0x1076fd625 WTF::HashTable<WebCore::Element*, WebCore::Element*,
> WTF::IdentityExtractor, WTF::PtrHash<WebCore::Element*>,
> WTF::HashTraits<WebCore::Element*>, WTF::HashTraits<WebCore::Element*>
> >::HashTable()
> 2   0x1076fd605 WTF::HashSet<WebCore::Element*,
> WTF::PtrHash<WebCore::Element*>, WTF::HashTraits<WebCore::Element*>
> >::HashSet()
> 3   0x1076a8d65 WTF::HashSet<WebCore::Element*,
> WTF::PtrHash<WebCore::Element*>, WTF::HashTraits<WebCore::Element*>
> >::HashSet()
> 4   0x10789c652
> WebCore::TreeScopeOrderedMap::MapEntry::MapEntry(WebCore::Element*)
> 5   0x10789c5fd
> WebCore::TreeScopeOrderedMap::MapEntry::MapEntry(WebCore::Element*)
> 6   0x10789c0cf WebCore::TreeScopeOrderedMap::add(WTF::AtomicStringImpl
> const&, WebCore::Element&, WebCore::TreeScope const&)::$_0::operator()()
> const
> 7   0x10789afd5 void
> WTF::HashMapEnsureTranslator<WTF::HashMap<WTF::AtomicStringImpl const*,
> WebCore::TreeScopeOrderedMap::MapEntry, WTF::PtrHash<WTF::AtomicStringImpl
> const*>, WTF::HashTraits<WTF::AtomicStringImpl const*>,
> WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry>
> >::KeyValuePairTraits, WTF::PtrHash<WTF::AtomicStringImpl const*>
> >::translate<WTF::KeyValuePair<WTF::AtomicStringImpl const*,
> WebCore::TreeScopeOrderedMap::MapEntry>, WTF::AtomicStringImpl const*,
> WebCore::TreeScopeOrderedMap::add(WTF::AtomicStringImpl const&,
> WebCore::Element&, WebCore::TreeScope
> const&)::$_0>(WTF::KeyValuePair<WTF::AtomicStringImpl const*,
> WebCore::TreeScopeOrderedMap::MapEntry>&, WTF::AtomicStringImpl const*&&,
> WebCore::TreeScopeOrderedMap::add(WTF::AtomicStringImpl const&,
> WebCore::Element&, WebCore::TreeScope const&)::$_0&&)
> 8   0x10789ac73
> WTF::HashTableAddResult<WTF::HashTableIterator<WTF::AtomicStringImpl const*,
> WTF::KeyValuePair<WTF::AtomicStringImpl const*,
> WebCore::TreeScopeOrderedMap::MapEntry>,
> WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WTF::AtomicStringImpl
> const*, WebCore::TreeScopeOrderedMap::MapEntry> >,
> WTF::PtrHash<WTF::AtomicStringImpl const*>,
> WTF::HashMap<WTF::AtomicStringImpl const*,
> WebCore::TreeScopeOrderedMap::MapEntry, WTF::PtrHash<WTF::AtomicStringImpl
> const*>, WTF::HashTraits<WTF::AtomicStringImpl const*>,
> WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry>
> >::KeyValuePairTraits, WTF::HashTraits<WTF::AtomicStringImpl const*> > >
> WTF::HashTable<WTF::AtomicStringImpl const*,
> WTF::KeyValuePair<WTF::AtomicStringImpl const*,
> WebCore::TreeScopeOrderedMap::MapEntry>,
> WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WTF::AtomicStringImpl
> const*, WebCore::TreeScopeOrderedMap::MapEntry> >,
> WTF::PtrHash<WTF::AtomicStringImpl const*>,
> WTF::HashMap<WTF::AtomicStringImpl const*,
> WebCore::TreeScopeOrderedMap::MapEntry, WTF::PtrHash<WTF::AtomicStringImpl
> const*>, WTF::HashTraits<WTF::AtomicStringImpl const*>,
> WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry>
> >::KeyValuePairTraits, WTF::HashTraits<WTF::AtomicStringImpl const*>
> >::add<WTF::HashMapEnsureTranslator<WTF::HashMap<WTF::AtomicStringImpl
> const*, WebCore::TreeScopeOrderedMap::MapEntry,
> WTF::PtrHash<WTF::AtomicStringImpl const*>,
> WTF::HashTraits<WTF::AtomicStringImpl const*>,
> WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry>
> >::KeyValuePairTraits, WTF::PtrHash<WTF::AtomicStringImpl const*> >,
> WTF::AtomicStringImpl const*,
> WebCore::TreeScopeOrderedMap::add(WTF::AtomicStringImpl const&,
> WebCore::Element&, WebCore::TreeScope const&)::$_0>(WTF::AtomicStringImpl
> const*&&, WebCore::TreeScopeOrderedMap::add(WTF::AtomicStringImpl const&,
> WebCore::Element&, WebCore::TreeScope const&)::$_0&&)
> 
> Wasted capacity: 63448 bytes (used 42856 of 106304 bytes, utilization:
> 40.31%) - 22 allocations
> 1   0x1078997a5 WTF::HashTable<WTF::AtomicStringImpl const*,
> WTF::KeyValuePair<WTF::AtomicStringImpl const*,
> WebCore::TreeScopeOrderedMap::MapEntry>,
> WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WTF::AtomicStringImpl
> const*, WebCore::TreeScopeOrderedMap::MapEntry> >,
> WTF::PtrHash<WTF::AtomicStringImpl const*>,
> WTF::HashMap<WTF::AtomicStringImpl const*,
> WebCore::TreeScopeOrderedMap::MapEntry, WTF::PtrHash<WTF::AtomicStringImpl
> const*>, WTF::HashTraits<WTF::AtomicStringImpl const*>,
> WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry>
> >::KeyValuePairTraits, WTF::HashTraits<WTF::AtomicStringImpl const*>
> >::HashTable()
> 2   0x107899785 WTF::HashMap<WTF::AtomicStringImpl const*,
> WebCore::TreeScopeOrderedMap::MapEntry, WTF::PtrHash<WTF::AtomicStringImpl
> const*>, WTF::HashTraits<WTF::AtomicStringImpl const*>,
> WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry> >::HashMap()
> 3   0x107899765 WTF::HashMap<WTF::AtomicStringImpl const*,
> WebCore::TreeScopeOrderedMap::MapEntry, WTF::PtrHash<WTF::AtomicStringImpl
> const*>, WTF::HashTraits<WTF::AtomicStringImpl const*>,
> WTF::HashTraits<WebCore::TreeScopeOrderedMap::MapEntry> >::HashMap()
> 4   0x107899745 WebCore::TreeScopeOrderedMap::TreeScopeOrderedMap()
> 5   0x107899725 WebCore::TreeScopeOrderedMap::TreeScopeOrderedMap()
> 6   0x107a54296 WebCore::HTMLDocument::HTMLDocument(WebCore::Frame*,
> WebCore::URL const&, unsigned char, unsigned int)
> 7   0x107a54358 WebCore::HTMLDocument::HTMLDocument(WebCore::Frame*,
> WebCore::URL const&, unsigned char, unsigned int)
> 8   0x10768a2a7 WebCore::HTMLDocument::create(WebCore::Frame*, WebCore::URL
> const&)

Were you using a debug build? This particular HashSet seems to be debug-only.