Tests:
  • Using the spread operator

    x
     
    const firstObject = {
      name: 'Alice',
      age: 25,
      contact: {
        email: 'alice@example.com',
        phone: '123-456-7890',
      },
      preferences: {
        language: 'English',
        timezone: 'UTC',
      },
    };
    const secondObject = {
      job: 'Software Engineer',
      skills: ['JavaScript', 'React', 'Node.js'],
      contact: {
        email: 'alice.work@example.com',
      },
      preferences: {
        theme: 'dark mode',
      },
    };
    const finalObject = {
        ...firstObject,
        ...secondObject
    };
  • Using Object.assign

     
    const firstObject = {
      name: 'Alice',
      age: 25,
      contact: {
        email: 'alice@example.com',
        phone: '123-456-7890',
      },
      preferences: {
        language: 'English',
        timezone: 'UTC',
      },
    };
    const secondObject = {
      job: 'Software Engineer',
      skills: ['JavaScript', 'React', 'Node.js'],
      contact: {
        email: 'alice.work@example.com',
      },
      preferences: {
        theme: 'dark mode',
      },
    };
    const finalObject = Object.assign(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

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one month ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Chrome 132 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Using the spread operator 15247128.0 Ops/sec
Using Object.assign 19903526.0 Ops/sec