Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Javascript: Array concat vs spread operator vs push speed test
Compare the new ES6 spread operator with the traditional concat() method and push. (by j3)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; rv:120.0) Gecko/20100101 Firefox/120.0
Browser:
Firefox 120
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
Push
12.3M/s
Array.prototype.concat
1.2M/s
spread operator
718K/s
View exact numbers
Test name
Executions per second
✓
Push
12,336,349 Ops/sec
Array.prototype.concat
1,211,702 Ops/sec
spread operator
718,070 Ops/sec
Tests:
Array.prototype.concat
var newValue = { foo: 'baz', bar: 'biz' }; var existingArray = []; var i = 0; while(i++ < 10) { existingArray.concat([newValue]); };
spread operator
var newValue = { foo: 'baz', bar: 'biz' }; var existingArray = []; var i = 0; while(i++ < 10) { existingArray = [...existingArray, newValue]; };
Push
var newValue = { foo: 'baz', bar: 'biz' }; var existingArray = []; var i = 0; while(i++ < 10) { existingArray.push(newValue); };