dmmleco

Benchmark created by Łukasz Mleczko on


Preparation HTML

<div id="myList"></div>

Test runner

Ready to run.

Testing in
TestOps/sec
t1
var myListHTML = document.getElementById("myList").innerHTML;
var i = 100;
do {
  myListHTML += "<span>" + i + "</span>";
} while (i--);
ready
t2
var start = (function() {
  var myListHTML = document.getElementById("myList").innerHTML;
  var i = 100;
  return function() {
    do {
      myListHTML += "<span>" + i + "</span>";
    }while (i--);
    return "done";
  }
})();
start();
ready
t3
var start = (function() {
  var myListHTML = document.getElementById("myList").innerHTML;
  var i = 100;
  return function() {
    while (i--) {
      myListHTML += "<span>" + i + "</span>";
    }
    return "done";
  }
})();
start();
ready
t4
var i = 0;
var myListHTML = document.getElementById("myList").innerHTML;
[lbl] start:
myListHTML += "<span>" + i + "</span>";
i++;
if(i < 100) goto start;
ready

Revisions

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

  • Revision 1: published by Łukasz Mleczko on