Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
reduce.concat() vs flat() vs spread concat()
Compare the new ES6 spread operator with the traditional concat() method
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36
Browser:
Chrome 146
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
6 months ago
Benchmark engine:
Benchmark.js
spread concat
23.6M/s
reduce + Array.prototype.concat
21.6M/s
Array.prototype.flat
11.7M/s
View exact numbers
Test name
Executions per second
✓
spread concat
23,640,148 Ops/sec
reduce + Array.prototype.concat
21,576,130 Ops/sec
Array.prototype.flat
11,721,929 Ops/sec
Tests:
reduce + Array.prototype.concat
var params = [[ "a", "b" ], [ "c", "d", "e" ]]; var other = params.reduce((acc, val) => acc.concat(val), []);
Array.prototype.flat
var params = [[ "a", "b" ], [ "c", "d", "e" ]]; var other = params.flat();
spread concat
var params = [[ "a", "b" ], [ "c", "d", "e" ]]; var other = ([]).concat(...params);