Tests:
  • Using the spread operator

    AخA
     
    const firstObject = { sampleData: 'Hello world' }
    const secondObject = { moreData: 'foo bar' }
    const finalObject = {
        ...firstObject,
        ...secondObject
    };
  • Using Object.assign

    x
     
    const firstObject = { sampleData: 'Hello world' }
    const secondObject = { moreData: 'foo bar' }
    const finalObject = {};
    Object.assign(finalObject, firstObject, secondObject);
  • ajostg[pf

     
    const firstObject = { sampleData: 'Hello world' }
    const secondObject = { moreData: 'foo bar' }
    const finalObject = {};
    Object.assign(finalObject, { ...firstObject, ...secondObject });
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Using the spread operator
    Using Object.assign
    ajostg[pf

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36
Chrome 81 on Windows 7
View result in a separate tab
Test name Executions per second
Using the spread operator 10051234.0 Ops/sec
Using Object.assign 1965391.2 Ops/sec
ajostg[pf 1644342.9 Ops/sec