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 19201438.0 Ops/sec
Destructuring 18080626.0 Ops/sec
Script Preparation code:
AخA
 
const obj = { one: 'one' }
Tests:
  • Object.assign

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

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