Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Chrome 135
Linux
Desktop
one year ago
items[items.length] outer length counter + new Array()
124K/s
Direct assign an item to an initialized array
124K/s
Cutting empty tail
108K/s
items[items.length] outer length counter
78K/s
items[items.length]
75K/s
Push item to an array
52K/s
Append an item by spread
662/s
View exact numbers
Test name Executions per second
items[items.length] outer length counter + new Array() 123,683 Ops/sec
Direct assign an item to an initialized array 123,553 Ops/sec
Cutting empty tail 108,285 Ops/sec
items[items.length] outer length counter 78,443 Ops/sec
items[items.length] 75,364 Ops/sec
Push item to an array 52,275 Ops/sec
Append an item by spread 662 Ops/sec
Script Preparation code:
Tests: