Array Length

Benchmark created on


Setup

var theArray = ["a", "b", 1, null, {}, [], undefined, "c", true];
    var iterations = 10000;

Test runner

Ready to run.

Testing in
TestOps/sec
Length Cached
var l = theArray.length;
var result = true;
while(iterations--) {  
  for(var i=0; i < l; i++) {
    result = result && !!theArray[i];
  }
}
ready
Length Accessed
var result = true;
while(iterations--) {  
  for(var i=0; i < theArray.length; i++) {
    result = result && !!theArray[i];
  }
}
ready

Revisions

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