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
112K/s
items[items.length] outer length counter + new Array()
86K/s
items[items.length] outer length counter
75K/s
items[items.length]
72K/s
Push item to an array
49K/s
Append an item by spread
620/s
View exact numbers
Test name Executions per second
Direct assign an item to an initialized array 111,910 Ops/sec
items[items.length] outer length counter + new Array() 85,734 Ops/sec
items[items.length] outer length counter 74,670 Ops/sec
items[items.length] 71,566 Ops/sec
Push item to an array 49,424 Ops/sec
Append an item by spread 620 Ops/sec
Script Preparation code:
Tests: