Comparison of loops

Benchmark created by davidThomas on


Preparation HTML

<select id="selectElementId"></select>

Test runner

Ready to run.

Testing in
TestOps/sec
Mine
var min = 12,
    max = 100,
    select = document.getElementById('selectElementId');

for (var i = min; i <= max; i++) {
  var opt = document.createElement('option');
  opt.value = i;
  opt.innerHTML = i;
  select.appendChild(opt);
}
ready
Šime Vidas
var select = document.getElementById('selectElementId');

for (i = 12; i <= 100; i += 1) {
  option = document.createElement('option');
  option.value = option.text = i;
  select.add(option);
}
ready

Revisions

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

  • Revision 1: published by davidThomas on