Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array concat vs spread operator vs push vs array length + assign
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Browser:
Chrome 128
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Array.prototype.concat
4316643.5 Ops/sec
spread operator
7995311.0 Ops/sec
Push
7441763.0 Ops/sec
length + assign
1123919.0 Ops/sec
Script Preparation code:
var orig = [ "hello", true, 7 ];
Tests:
Array.prototype.concat
var other = [ 1, 2 ].concat(orig);
spread operator
var other = [ 1, 2, ...orig ]
Push
var other = [ 1, 2 ].push(...orig);
length + assign
var other = [ 1, 2 ]; other.length = other.length + orig.length for(var i = 0; i < orig.length; i++) { other[other.length + i] = orig[i] }