Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:141.0) Gecko/20100101 Firefox/141.0
Firefox 141
Linux
Desktop
8 months ago
Test name Executions per second
Using the spread operator 10577992.0 Ops/sec
Using Object.assign 22762226.0 Ops/sec
Manually copying properties 71035976.0 Ops/sec
Create new object while copying 377939520.0 Ops/sec
Create new object from scratch 406770144.0 Ops/sec
StructuredClone 925358.5 Ops/sec
JSON 1161255.2 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