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
Test name Executions per second
Push item to an array 36145.0 Ops/sec
Append an item by spread 65.9 Ops/sec
Direct assign an item to an initialized array 74115.5 Ops/sec
items[items.length] 44867.3 Ops/sec
items[items.length] outer length counter 44740.8 Ops/sec
items[items.length] outer length counter + new Array() 71488.5 Ops/sec
Cutting empty tail 64240.8 Ops/sec
Script Preparation code:
Tests:
  • Push item to an array

  • Append an item by spread

  • Direct assign an item to an initialized array

  • items[items.length]

  • items[items.length] outer length counter

  • items[items.length] outer length counter + new Array()

  • Cutting empty tail