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
items[items.length] outer length counter + new Array()
110K/s
Direct assign an item to an initialized array
110K/s
items[items.length] outer length counter
75K/s
items[items.length]
71K/s
Push item to an array
46K/s
Append an item by spread
574/s
View exact numbers
Test name Executions per second
items[items.length] outer length counter + new Array() 109,864 Ops/sec
Direct assign an item to an initialized array 109,675 Ops/sec
items[items.length] outer length counter 74,661 Ops/sec
items[items.length] 70,598 Ops/sec
Push item to an array 45,581 Ops/sec
Append an item by spread 574 Ops/sec
Script Preparation code:
Tests: