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 827764.8 Ops/sec
Get copy using spread 8748345.0 Ops/sec
Get copy using structuredClone 208497.6 Ops/sec
Copy manually using for loop 378625.7 Ops/sec
Copy using JSON.stringify 173748.0 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