Tests:
  • spread operator

    x
     
    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) => {
        findingInOpp.findingList.forEach(({ findingId }) => acc.push(findingId))
        return acc
    },[])
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    spread operator
    Push

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/85.0.4183.92 Mobile/15E148 Safari/604.1
Chrome Mobile iOS 85 on iOS 13.3
View result in a separate tab
Test name Executions per second
spread operator 1786017.9 Ops/sec
Push 4701227.5 Ops/sec