innerHTML_x_dom

JavaScript performance comparison

Test case created

Info

which faster

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
DOM API
var div=document.createElement('div');
for(var i=0;i<1000;i++){
  var p=document.createElement('p');
  p.appendChild( document.createTextNode(i) );
  div.appendChild(p);
}
pending…
innerHTML=
var div=document.createElement('div');
var html='';
for(var i=0;i<1000;i++){
  html+='<p>'+i+'</p>';
}
div.innerHTML=html;
pending…
innerHTML+=
var div=document.createElement('div');
for(var i=0;i<1000;i++){
  div.innerHTML+='<p>'+i+'</p>';
}
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 comments

Add a comment