Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/60.5 Safari/605.1.15
Safari 60
Ubuntu
Desktop
one year ago
Direct assign an item to an initialized array
227K/s
items[items.length] outer length counter + new Array()
226K/s
Cutting empty tail
178K/s
items[items.length] outer length counter
128K/s
Push item to an array
126K/s
items[items.length]
124K/s
Append an item by spread
283/s
View exact numbers
Test name Executions per second
Direct assign an item to an initialized array 227,287 Ops/sec
items[items.length] outer length counter + new Array() 226,281 Ops/sec
Cutting empty tail 177,604 Ops/sec
items[items.length] outer length counter 127,557 Ops/sec
Push item to an array 126,188 Ops/sec
items[items.length] 124,162 Ops/sec
Append an item by spread 283 Ops/sec
Script Preparation code:
Tests: