Tests:
  • deconstruct

    AخA
     
    "use strict";
    class Box {
        constructor(params = {}) {
            var { x = 0, y = 0, height = 1, width = 1 } = params;
            this.x = x;
            this.y = y;
            this.height = height;
            this.width = width;
        }
    }
    const b = new Box({ x:3, y: 0, height: 23, width: 1});
    console.assert(b.x === 3)
  • Object.assign

     
    class Box {
      constructor(params = {}){
            this.x = 0;
            this.y = 0;
            this.height = 1;
            this.width = 1;
            Object.assign(this, params);
      }
    }
    const a = new Box({ x:3, y: 0, height: 23, width: 1});
    console.assert(a.x === 3)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    deconstruct
    Object.assign

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Chrome 102 on Windows
View result in a separate tab
Test name Executions per second
deconstruct 331103.6 Ops/sec
Object.assign 278221.2 Ops/sec