Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Chrome 130
Mac OS X 10.15.7
Desktop
21 days ago
Test name Executions per second
Get copy using Object.create 781870.2 Ops/sec
Get copy using spread 8604332.0 Ops/sec
Get copy using structuredClone 198837.4 Ops/sec
Copy manually using for loop 306646.2 Ops/sec
Copy using JSON.stringify 171053.5 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