Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JavaScript Array concat vs spread vs push
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Browser:
Chrome 119
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Concat
67863.8 Ops/sec
Spread
70610.0 Ops/sec
Push
75367.0 Ops/sec
Tests:
Concat
const first = Array(1000).fill(null).map((_, i) => i); const second = Array(1000).fill(null).map((_, i) => i + 1000); const third = first.concat(second);
Spread
const first = Array(1000).fill(null).map((_, i) => i); const second = Array(1000).fill(null).map((_, i) => i + 1000); const third = [...first, ...second];
Push
const first = Array(1000).fill(null).map((_, i) => i); const second = Array(1000).fill(null).map((_, i) => i + 1000); const third = []; third.push(...first); third.push(...second);