Bug 76591 - Cache and reuse the NodeList returned by Node::childNodes().
Summary: Cache and reuse the NodeList returned by Node::childNodes().
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords:
: 17184 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-01-18 17:44 PST by Andreas Kling
Modified: 2012-02-17 15:16 PST (History)
1 user (show)

See Also:


Attachments
Patch (13.52 KB, patch)
2012-01-18 18:18 PST, Andreas Kling
rniwa: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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. ***