Tests:
  • Using the spread operator

  • Well-known Keys, Create new object while copying, [] accessor

  • Well-known Keys, Manually copying properties, [] accessor

  • Object.entries() + map

  • Object.keys() + map

  • Well-Known Numbered Keynames w/Known Length

  • Well-Known Keys, for..in

  • Well-Known Keys, for..of

  • Well-Known Keys, forEach

  • Object Assign pre-created

  • Well-known Keys, extract and create new object while copying, . accessor

  • structuredClone

  • Iterable

  • Iterate Copy - Object.entries() + for..of

  • Iterate Copy - Object.keys().forEach

  • Iterate Copy - for..in

  • Iterate Copy - Object.entries()

  • Statically create new same object from scratch

  • Well-known Keys, Create new object while copying

  • Well-known Keys, Manually copying properties

  • Using Object.assign

  • JSON Copy

  • Well-known Keys, extract and create new object while copying, [] accessor

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    Using the spread operator
    Well-known Keys, Create new object while copying, [] accessor
    Well-known Keys, Manually copying properties, [] accessor
    Object.entries() + map
    Object.keys() + map
    Well-Known Numbered Keynames w/Known Length
    Well-Known Keys, for..in
    Well-Known Keys, for..of
    Well-Known Keys, forEach
    Object Assign pre-created
    Well-known Keys, extract and create new object while copying, . accessor
    structuredClone
    Iterable
    Iterate Copy - Object.entries() + for..of
    Iterate Copy - Object.keys().forEach
    Iterate Copy - for..in
    Iterate Copy - Object.entries()
    Statically create new same object from scratch
    Well-known Keys, Create new object while copying
    Well-known Keys, Manually copying properties
    Using Object.assign
    JSON Copy
    Well-known Keys, extract and create new object while copying, [] accessor

    Fastest: N/A

    Slowest: N/A

Get performance results from real users on your website with Request Metrics.
Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
Chrome 110 on Windows
View result in a separate tab
Test name Executions per second
Using the spread operator 31367270.0 Ops/sec
Using Object.assign 3469380.0 Ops/sec
Well-known Keys, Manually copying properties 719914300.0 Ops/sec
Well-known Keys, Create new object while copying 745517500.0 Ops/sec
Statically create new same object from scratch 739994100.0 Ops/sec
Iterate Copy - Object.entries() 2192555.0 Ops/sec
Iterate Copy - for..in 4871326.0 Ops/sec
Iterate Copy - Object.keys().forEach 2200771.0 Ops/sec
Iterate Copy - Object.entries() + for..of 2236970.0 Ops/sec
Iterable 419329.1 Ops/sec
JSON Copy 608850.4 Ops/sec
structuredClone 282568.2 Ops/sec
Object Assign pre-created 3350355.0 Ops/sec
Well-Known Keys, forEach 3417576.0 Ops/sec
Well-Known Keys, for..of 3714739.0 Ops/sec
Well-Known Keys, for..in 1563593.0 Ops/sec
Well-Known Numbered Keynames w/Known Length 1246324.0 Ops/sec
Object.keys() + map 2107893.0 Ops/sec
Object.entries() + map 1213453.0 Ops/sec
Well-known Keys, Manually copying properties, [] accessor 728586400.0 Ops/sec
Well-known Keys, Create new object while copying, [] accessor 736682200.0 Ops/sec
Well-known Keys, extract and create new object while copying, . accessor 724703400.0 Ops/sec
Well-known Keys, extract and create new object while copying, [] accessor 721244500.0 Ops/sec