Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:136.0) Gecko/20100101 Firefox/136.0
Firefox 136
Mac OS X 10.15
Desktop
one month ago
Test name Executions per second
Object.assign 21209232.0 Ops/sec
Destructuring 13726364.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; }};