Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15
Safari 17
Mac OS X 10.15.7
Desktop
6 months ago
Test name Executions per second
Using the spread operator 9366734.0 Ops/sec
Using Object.assign 9509962.0 Ops/sec
Manually copying properties 178988736.0 Ops/sec
Create new object while copying 177234320.0 Ops/sec
Create new object from scratch 398706880.0 Ops/sec
Tests:
  • Using the spread operator

  • Using Object.assign

  • Manually copying properties

  • Create new object while copying

  • Create new object from scratch