Tests:
  • Using the spread operator

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

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

     
    const firstObject = { sampleData: 'Hello world' }
    const secondObject = { moreData: 'foo bar' }
    let finalObject = {}
    finalObject.someData = firstObject.someData
    finalObject.moreData = secondObject.moreData
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
    Access

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 6 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36
Safari 537.36 on Windows
View result in a separate tab
Test name Executions per second
Using the spread operator 2102736.5 Ops/sec
Using Object.assign 1903698.9 Ops/sec
Access 561848000.0 Ops/sec