[Webkit-unassigned] [Bug 73853] Inserting nodes is slow due to Node::notifyNodeListsAttributeChanged (20%+)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Dec 5 16:35:28 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=73853





--- Comment #4 from Ryosuke Niwa <rniwa at webkit.org>  2011-12-05 16:35:27 PST ---
Thanks for the comment, Sam!

(In reply to comment #3)
>     notifyNodeListsAttributeChanged(); // FIXME: Can do better some day. Really only care about the name attribute changing.
> 
> Not sure if that is still true, but it is telling.

Yes. This is exactly the issue. We're walking up the tree (ancestors) per every node insertion and removal.

> The most obvious optimization that comes to mind is keeping a bit on the Document noting if there are any NodeLists that need to be invalidated (like we do with certain event listeners).  The effectiveness of that optimization would be dependent on how many pages use NamedNodeLists and/or ClassNodeList.

We already do this (m_numNodeListCaches in TreeScope) but turned out be not so useful because almost every single web page uses querySelector/getElementById, etc...

> A better approach is probably to look at the callers to dispatchSubtreeModifiedEvent(), and see how many of them know that these caches don't need to be invalidated.  The one in CharacterData, for instance, probably knows that those node lists can't have changed.

That's a good point. I hadn't thought about this case.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list