domcreation

JavaScript performance comparison

Test case created

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
documentFragment
var df = document.createDocumentFragment();
var ul = document.createElement( 'ul' );

for ( var i = 0; i < 1000; i += 1 ) {
  df.appendChild( document.createTextNode( '<li>' + i + '</li>' ) );
}


ul.appendChild( df );
pending…
innerHTML
var ul = document.createElement( 'ul' );
var items = [];

for ( var i = 0; i < 1000; i += 1 ) {
  items.push( '<li>' + i + '</li>' );
}

ul.innerHTML = items.join( '' );
pending…
innerHTML2
var ul = document.createElement( 'ul' );
var items = [];

for ( var i = 0; i < 1000; i += 1 ) {
  items.push( document.createTextNode( '<li>' + i + '</li>' ) );
}

ul.innerHTML = items.join( '' );
pending…
innerHTML3
var ul = document.createElement( 'ul' );

for ( var i = 0; i < 1000; i += 1 ) {
  ul.innerHTML += document.createTextNode( '<li>' + i + '</li>' );
}

 
pending…
innerHTML4
var ul = document.createElement( 'ul' );

for ( var i = 0; i < 1000; i += 1 ) {
  ul.innerHTML += '<li>' + i + '</li>';
}
 
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