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

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 3469379.5 Ops/sec
Well-known Keys, Manually copying properties 719914304.0 Ops/sec
Well-known Keys, Create new object while copying 745517504.0 Ops/sec
Statically create new same object from scratch 739994112.0 Ops/sec
Iterate Copy - Object.entries() 2192555.2 Ops/sec
Iterate Copy - for..in 4871325.5 Ops/sec
Iterate Copy - Object.keys().forEach 2200771.2 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 3350354.5 Ops/sec
Well-Known Keys, forEach 3417575.5 Ops/sec
Well-Known Keys, for..of 3714738.5 Ops/sec
Well-Known Keys, for..in 1563593.4 Ops/sec
Well-Known Numbered Keynames w/Known Length 1246324.4 Ops/sec
Object.keys() + map 2107892.5 Ops/sec
Object.entries() + map 1213452.5 Ops/sec
Well-known Keys, Manually copying properties, [] accessor 728586368.0 Ops/sec
Well-known Keys, Create new object while copying, [] accessor 736682240.0 Ops/sec
Well-known Keys, extract and create new object while copying, . accessor 724703360.0 Ops/sec
Well-known Keys, extract and create new object while copying, [] accessor 721244544.0 Ops/sec


;