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
  • object with concat

     
    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
    object with concat

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36
Chrome 84 on Linux
View result in a separate tab
Test name Executions per second
array 9.8 Ops/sec
object 8.2 Ops/sec
object with text field 1.5 Ops/sec
object with concat 1.6 Ops/sec