You need to
before you can comment on or make changes to this bug.
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%).