Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Chrome 131
Mac OS X 10.15.7
Desktop
21 days ago
Test name Executions per second
Get copy using Object.create 1700138.8 Ops/sec
Get copy using spread 14897090.0 Ops/sec
Get copy using structuredClone 370700.4 Ops/sec
Copy manually using for loop 733511.2 Ops/sec
Copy using JSON.stringify 387997.2 Ops/sec
Script Preparation code:
Tests:
  • Get copy using Object.assign

  • Get copy using spread

  • Get copy using structuredClone

  • Copy manually using for loop

  • Copy using JSON.stringify