Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
Chrome 133
Mac OS X 10.15.7
Desktop
2 months ago
Test name Executions per second
Object.assign 41582312.0 Ops/sec
Destructuring 63634908.0 Ops/sec
Script Preparation code:
AخA
 
const obj = { one: 'one' };
Tests:
  • Object.assign

     
    const res = Object.assign(obj, { toString: function() { return this.one; }});
  • Destructuring

     
    const res = {...obj, toString: function() { return this.one; }};