Script Preparation code:
x
 
for (i = 0; i < 10; i++) {
}
Tests:
  • Test Spread operator

     
    const firstObject = {
      sampleData: 'Hello world',
      sampleMethod: () => { return true; }
    };
    const secondObject = {...firstObject};
  • Test Object.create

     
    const firstObject = {
      sampleData: 'Hello world',
      sampleMethod: () => { return true; }
    };
    const secondObject = Object.create(firstObject);
  • Test Object.assign

     
    const firstObject = {
      sampleData: 'Hello world',
      sampleMethod: () => { return true; }
    };
    const secondObject = Object.assign({}, firstObject);
  • Test New Object

     
    class firstObject {
      constructor() {
        this.sampleData = 'Hello world',
        this.sampleMethod = () => { return true; }
      }
    };
    const secondObject = new firstObject();
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Test Spread operator
    Test Object.create
    Test Object.assign
    Test New Object

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one month ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Chrome 132 on Windows
View result in a separate tab
Test name Executions per second
Test Spread operator 51637868.0 Ops/sec
Test Object.create 2057473.9 Ops/sec
Test Object.assign 19372564.0 Ops/sec
Test New Object 696882.6 Ops/sec