IE9+: poor performance while dealing with DOM

2019-04-10 21:59发布

问题:

Compared to other browsers, IE9 executes this script (for dynamic manipulation of DOM) with a very long running time. I am curious; in what ways would it impact the execution speed of next-generation rich applications? Other than this iterative test, is there any related real world webapp example, where we can observe the difference in performance? Also, is it the problem with their JS engine or the Layout engine?

Update:

The issue is resolved in IE10 RTM.

回答1:

Use:

function testAppendFrag(div) {
    var docFrag=document.createDocumentFragment(),i=count;
    while(i--){
        docFrag.appendChild(document.createElement("div"));
    }
    div.appendChild(docFrag.cloneNode(true));
}