Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JavaScript V8 Array.push vs spread operator
Which is faster
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:146.0) Gecko/20100101 Firefox/146.0
Browser:
Firefox 146
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
4 months ago
Test name
Executions per second
Array.push in for loop
225161.3 Ops/sec
Spread operator
21044.3 Ops/sec
Tests:
Array.push in for loop
const arr1 = Array(1000).fill(0); const arr2 = Array(0); for (const el of arr1) { arr2.push(el) }
Spread operator
const arr1 = Array(10000).fill(0); let arr2 = Array(0); for (const el of arr1) { arr2 = [arr2, el] }