Bug 76591

Summary: Cache and reuse the NodeList returned by Node::childNodes().
Product: WebKit Reporter: Andreas Kling <kling>
Component: DOMAssignee: Andreas Kling <kling>
Status: RESOLVED FIXED    
Severity: Normal CC: rboucher
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch rniwa: review+

Description Andreas Kling 2012-01-18 17:44:31 PST
We already cache the DynamicNodeList::Caches on NodeRareData, we should cache the entire ChildNodeList instead of recreating it every time to reduce memory consumption and match the behavior of other browsers.
Comment 1 Andreas Kling 2012-01-18 18:18:11 PST
Created attachment 123048 [details]
Patch
Comment 2 Ryosuke Niwa 2012-01-18 18:30:03 PST
Comment on attachment 123048 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=123048&action=review

Could you clarify that new behavior matches FF/Opera as discussed on IRC?

> Source/WebCore/dom/ChildNodeList.h:44
> +        void reset() { m_caches->reset(); }

We should move m_caches to DynamicNodList. Once we do that, we can just call DyanmicNodeList::invalidateCache instead.
Comment 3 Ryosuke Niwa 2012-01-18 18:34:34 PST
Comment on attachment 123048 [details]
Patch

kling says he'll do the m_caches move in a follow up. r=me provided the change log entry is updated to mention the improved compatibility with other browsers.
Comment 4 Andreas Kling 2012-01-18 18:55:14 PST
Committed r105372: <http://trac.webkit.org/changeset/105372>
Comment 5 Adam Barth 2012-02-17 15:16:41 PST
*** Bug 17184 has been marked as a duplicate of this bug. ***