Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Array spread operator vs push in reduce
Compare the new ES6 spread operator with push inside reduce
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1
Browser:
Mobile Safari 11
Operating system:
iOS 11.0
Device Platform:
Mobile
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
Push
1.5M/s
spread operator
1.3M/s
View exact numbers
Test name
Executions per second
✓
Push
1,519,430 Ops/sec
spread operator
1,324,744 Ops/sec
Tests:
spread operator
var arr = [ { "opportunityId": 5943111, "findingList": [ { "findingId": 6919 } ], }, { "opportunityId": 5943111, "findingList": [ { "findingId": 6918, "findingId": 6917 } ] } ] arr.reduce((acc, findingInOpp) => [...acc, ...findingInOpp.findingList.map(({ findingId }) => findingId)],[])
Push
var arr = [ { "opportunityId": 5943111, "findingList": [ { "findingId": 6919 } ], }, { "opportunityId": 5943111, "findingList": [ { "findingId": 6918, "findingId": 6917 } ] } ] arr.reduce((acc, findingInOpp) => { acc.push(...findingInOpp.findingList.map(({ findingId }) => findingId)) return acc },[])