push vs spread
Date tested:
4 years ago
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36 Edg/85.0.564.41
Test name
Executions per second
push
9180772.0 Ops/sec
spread
20084.5 Ops/sec
Benchmark definition (click to collapse):
Script Preparation code:
var test1=Array.from({length: 10000},()=>Math.random()), test2 = [...test1]
Tests:
push
test1.push(123)
spread
[...test2, 123]
Open this result on MeasureThat.net