dom inter (v3)

Revision 3 of this benchmark created on


Preparation HTML

<ul id="list">
</ul>

Test runner

Ready to run.

Testing in
TestOps/sec
fall1
function domLoop() {
  for (var i = 0; i < 10; i++) {
    document.getElementById('list').innerHTML += "<li>Element1</li>";
  }
}
domLoop();
ready
fall2
function domLoop2() {
  var content = '';
  for (var i = 0; i < 10; i++) {
    content += "<li>Element2</li>";
  }
  document.getElementById('list').innerHTML += content;
}
domLoop2();
ready
fall3
function domLoop3() {
  var fragment = document.createDocumentFragment();

  for (var i = 0; i < 10; i++) {
    var TempEL = document.createElement('li');
    TempEL.innerHTML = "Element3";
    fragment.appendChild(TempEL);
  }
  document.getElementById('list').appendChild(fragment);
}
domLoop3();
ready
fall4
function domLoop4() {
  var fragment = document.createDocumentFragment();
  var TempEL = document.createElement('li');
  TempEL.innerHTML = "Element3";

  for (var i = 0; i < 10; i++) {

    fragment.appendChild(TempEL.cloneNode(true));
  }
  document.getElementById('list').appendChild(fragment);
}
domLoop4();
ready

Revisions

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