Javascript iteration

JavaScript performance comparison

Test case created by ReubenNahouraii

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  const count = 100 * 1000;
  var arr = [];
  for (let i = 0; i < count; i++) {
   arr.push(i);
  }

};
</script>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
10K items
let breakAt = 10 * 1000
let max = 0;
for (let i = 0; i < arr.length; i++) {
  const current = arr[i];
  if (current > max) max = current
  if (i >= breakAt) break;
}
pending…
100K items
let breakAt = 100 * 1000
let max = 0;
for (let i = 0; i < arr.length; i++) {
  const current = arr[i];
  if (current > max) max = current
  if (i >= breakAt) break;
}
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