Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0
Firefox 140
Linux
Desktop
7 months ago
Test name Executions per second
Using the spread operator 4453011.5 Ops/sec
Using Object.assign 6954302.5 Ops/sec
Manually copying properties 25480756.0 Ops/sec
Create new object while copying 176756176.0 Ops/sec
Create new object from scratch 175854336.0 Ops/sec
StructuredClone 244361.5 Ops/sec
JSON 397799.1 Ops/sec
Tests:
  • Using the spread operator

  • Using Object.assign

  • Manually copying properties

  • Create new object while copying

  • Create new object from scratch

  • StructuredClone

  • JSON