Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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
Benchmark engine:
Benchmark.js
spread operator
8.0M/s
Push
7.4M/s
Array.prototype.concat
4.3M/s
length + assign
1.1M/s
View exact numbers
Test name
Executions per second
✓
spread operator
7,995,311 Ops/sec
Push
7,441,763 Ops/sec
Array.prototype.concat
4,316,644 Ops/sec
length + assign
1,123,919 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] }