Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
concat vs spread vs push three arrays to new one FIX
Compare the spread, concat, push three arrays to new one
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/123.0.0.0 Safari/537.36
Browser:
Chrome 123
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
concat
2248988.2 Ops/sec
spread
3652131.5 Ops/sec
push
3230086.5 Ops/sec
Script Preparation code:
var a = [1, 2, 3, 4, 5, 'a', 'b', 'c']; var b = [6, 7, 8, 9, 10, 'd', 'e', 'f']; var c = [11, 12, 13, 14, 'g', 'h', 'i'];
Tests:
concat
var res = [].concat(a, b, c);
spread
var res = [...a, ...b, ...c];
push
const res = []; res.push(...a); res.push(...b); res.push(...c);