Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Chrome 132
Linux
Desktop
one year ago
Direct assign an item to an initialized array
113K/s
items[items.length] outer length counter + new Array()
111K/s
items[items.length] outer length counter
76K/s
items[items.length]
72K/s
Push item to an array
50K/s
Append an item by spread
623/s
View exact numbers
Test name Executions per second
Direct assign an item to an initialized array 112,956 Ops/sec
items[items.length] outer length counter + new Array() 111,014 Ops/sec
items[items.length] outer length counter 75,627 Ops/sec
items[items.length] 72,462 Ops/sec
Push item to an array 50,017 Ops/sec
Append an item by spread 623 Ops/sec
Script Preparation code:
Tests: