Script Preparation code:
x
 
var array = []
var object1 = {}
var object2 = {}
for(var i = 0; i < 1e6; i++) {
    var v = Math.random()
    array[i] = v
    object1[i] = v
    object2[`v${i}`] = v
}
Tests:
  • array

     
    var sum = 0
    for(var i = 1e6 - 1; i >= 0; i--) {
      sum += array[i]
    }
    sum
  • object

     
    var sum = 0
    for(var i = 1e6 - 1; i >= 0; i--) {
      sum += object1[i]
    }
    sum
  • object with text field

     
    var sum = 0
    for(var i = 1e6 - 1; i >= 0; i--) {
      sum += object2[`v${i}`]
    }
    sum
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    array
    object
    object with text field

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
Chrome 85 on Mac OS X 10.15.6
View result in a separate tab
Test name Executions per second
array 14.1 Ops/sec
object 11.7 Ops/sec
object with text field 1.9 Ops/sec