array length access new

Benchmark created by Alex on


Setup

var arr = [];
    
    for (var i =0 ;i < 1000; i++)
    arr.push(Math.random())

Test runner

Ready to run.

Testing in
TestOps/sec
"Fast"
var x = 0;
for (var i = 0, len = arr.length; i < len; i++)
  x += arr[i];
ready
"Slow"
var x = 0;
for (var i = 0; i < arr.length; i++)
  x += arr[i];
ready

Revisions

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

  • Revision 1: published by Alex on