Script Preparation code:
AخA
 
var n = 5;
var a = [];
var obj = {};
for (var i=0; i<a.length; i++) {
  a[i] = i;
  obj["obj" + i] = i;
}
Tests:
  • Array

     
    r = Math.floor(Math.random()*n);
    for (var i=0; i<a.length; i++) {
      if (a[i] == r) break;
    }
  • Object

     
    r = Math.floor(Math.random()*n);
    var i = obj["obj"+r];
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Array
    Object

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 7 years ago)
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0
Firefox 56 on Windows
View result in a separate tab
Test name Executions per second
Array 61726528.0 Ops/sec
Object 14848630.0 Ops/sec