Bug 102992 - potential performance improvement when moving nodes within the DOM
: potential performance improvement when moving nodes within the DOM
Status: NEW
: WebKit
: 528+ (Nightly build)
: Unspecified Unspecified
: P2 Normal
Assigned To:
  Show dependency treegraph
Reported: 2012-11-21 16:49 PST by
Modified: 2012-11-21 16:49 PST (History)



You need to log in before you can comment on or make changes to this bug.

Description From 2012-11-21 16:49:24 PST
Right now, appendChild will first remove the child if it's already in the tree and walk the whole subtree via ChildNodeRemovalNotifier(this).notify(child.get())) to call removedFrom and clear it's inDocument flag. If the nodes get appended right back into the document, there's no need to walk the whole subtree. The tricky bit is that there may be sync JS events that fire (e.g. blur, unload, mutation events). So, we could, in theory, do something like ChildNodesLazySnapshot, where we put off this work until dispatchEvent is actually called or until the appendChild is done, at which point we only need to make sure the inDocument bit is set correctly on the root.

One tricky bit will be making sure InspectorInstrumentation + DOM breakpoints continue to work right. Again, we only need to walk the subtree if there are DOM breakpoints set.

Avoiding other walks of the tree in the DOM modification code have proven to be a big performance improvement (e.g. ~10%).