Tests:
  • Using the spread operator

    x
     
    const firstObject = {
      attempts: 1,
      created_at: 1694778031091,
      expires_at: 1694778091091,
      source: {
        externalId: "831f76fc-5a9d-49bc-8d4b-114010cedb73",
        name: "Tengen Uzui",
        type: "phone",
      },
      type: "phone",
      value: "411273",
    };
    const finalObject = {
      ...firstObject,
      attempts: firstObject.attempts + 1,
    };
  • Using Object.assign

     
    const firstObject = {
      attempts: 1,
      created_at: 1694778031091,
      expires_at: 1694778091091,
      source: {
        externalId: "831f76fc-5a9d-49bc-8d4b-114010cedb73",
        name: "Tengen Uzui",
        type: "phone",
      },
      type: "phone",
      value: "411273",
    };
    const finalObject = Object.assign({
      attempts: firstObject.attempts + 1,
    }, firstObject);
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 year ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Chrome 116 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Using the spread operator 55731712.0 Ops/sec
Using Object.assign 8506396.0 Ops/sec