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 |
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 |