Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3424.0 Safari/537.36
Chrome 68
Linux
Desktop
one year ago
Direct assign an item to an initialized array
74K/s
items[items.length] outer length counter + new Array()
71K/s
Cutting empty tail
64K/s
items[items.length]
45K/s
items[items.length] outer length counter
45K/s
Push item to an array
36K/s
Append an item by spread
66/s
View exact numbers
Test name Executions per second
Direct assign an item to an initialized array 74,115 Ops/sec
items[items.length] outer length counter + new Array() 71,488 Ops/sec
Cutting empty tail 64,241 Ops/sec
items[items.length] 44,867 Ops/sec
items[items.length] outer length counter 44,741 Ops/sec
Push item to an array 36,145 Ops/sec
Append an item by spread 66 Ops/sec
Script Preparation code:
Tests: