Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
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
Test name
Executions per second
Array.prototype.concat
1211701.5 Ops/sec
spread operator
718070.1 Ops/sec
Push
12336349.0 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); };