Script Preparation code:
Tests:
  • Reduce + spread

  • Loop (for...in) with .keys()

  • Loop (for...in) with .entries()

  • Reduce + mutate

  • Reduce + mutate with entries()

  • Map with fromEntries

  • Loop (for...in) with mutate

  • Loop (for...in) with mutate (Object.assign)

  • Loop (for...in) with mutate (save object[key])

  • Loop (for...in) with unsafe mutate

  • Object.fromEntries with map

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    Reduce + spread
    Loop (for...in) with .keys()
    Loop (for...in) with .entries()
    Reduce + mutate
    Reduce + mutate with entries()
    Map with fromEntries
    Loop (for...in) with mutate
    Loop (for...in) with mutate (Object.assign)
    Loop (for...in) with mutate (save object[key])
    Loop (for...in) with unsafe mutate
    Object.fromEntries with map

    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/112.0.0.0 Safari/537.36
Chrome 112 on Windows
View result in a separate tab
Test name Executions per second
Reduce + spread 65.5 Ops/sec
Loop (for...in) with .keys() 393.1 Ops/sec
Loop (for...in) with .entries() 672.3 Ops/sec
Reduce + mutate 231.9 Ops/sec
Reduce + mutate with entries() 291.8 Ops/sec
Map with fromEntries 536.7 Ops/sec
Loop (for...in) with mutate 874.4 Ops/sec
Loop (for...in) with mutate (Object.assign) 411.2 Ops/sec
Loop (for...in) with mutate (save object[key]) 874.6 Ops/sec
Loop (for...in) with unsafe mutate 278.5 Ops/sec
Object.fromEntries with map 529.6 Ops/sec