| Summary: | EventListenerMap's m_entries vector wastes a lot of vector capacity | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Simon Fraser (smfr) <simon.fraser> | ||||
| Component: | DOM | Assignee: | Simon Fraser (smfr) <simon.fraser> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | cdumez, esprehn+autocc, ews-watchlist, kangil.han, rniwa, simon.fraser, webkit-bug-importer, ysuzuki | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | WebKit Local Build | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
|
Description
Simon Fraser (smfr)
2023-02-03 10:03:10 PST
This is hot code and this vector was tweaked recently for speedometer gains. If we make changes, we should run speedometer to make sure we don't regress. I ran Speedometer with some instrumentation. The max number of entries in the vector is 25, and the mean is 1.63. Here's a table of size frequencies (excluding zeros): Size Instance count 1 25751 2 3388 6 2010 3 2010 4 1020 5 50 25 20 9 18 17 8 Going to perf-test a patch that gets this down to: Wasted capacity: 11400 bytes (used 6680 of 18080 bytes, utilization: 36.95%) - 1959 allocations 1 0x3343c9df7 WebCore::EventListenerMap::EventListenerMap() 2 0x334dc5218 WebCore::RenderObject::RenderObject(WebCore::Node&) 3 0x334d20f58 WebCore::RenderElement::RenderElement(WebCore::Element&, WebCore::RenderStyle&&, unsigned int) 4 0x334d9b561 WebCore::RenderLayerModelObject::RenderLayerModelObject(WebCore::Element&, WebCore::RenderStyle&&, unsigned int) 5 0x334cf0281 WebCore::RenderBoxModelObject::RenderBoxModelObject(WebCore::Element&, WebCore::RenderStyle&&, unsigned int) diff --git a/Source/WebCore/dom/EventListenerMap.h b/Source/WebCore/dom/EventListenerMap.h
index 25a4340b6014f9e2bd2f1cd1b19760c86c30a6d7..55e619529189ad8bf80753514035d50be115c49c 100644
--- a/Source/WebCore/dom/EventListenerMap.h
+++ b/Source/WebCore/dom/EventListenerMap.h
@@ -74,7 +74,7 @@ public:
Lock& lock() { return m_lock; }
private:
- Vector<std::pair<AtomString, EventListenerVector>> m_entries;
+ Vector<std::pair<AtomString, EventListenerVector>, 0, CrashOnOverflow, 4> m_entries;
Lock m_lock;
};
Created attachment 464867 [details]
Patch
Commit message contains (OOPS!) and no reviewer found, blocking PR #None Committed 259920@main (ad21476ae97e): <https://commits.webkit.org/259920@main> Reviewed commits have been landed. Closing PR #9713 and removing active labels. |