Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0
Chrome 130
Windows
Desktop
14 days ago
Test name Executions per second
Get copy using Object.assign 1143950.1 Ops/sec
Get copy using spread 9728743.0 Ops/sec
Get copy using structuredClone 160712.1 Ops/sec
Copy manually using for loop 484449.8 Ops/sec
Copy using JSON.stringify 176001.1 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