Object.fromEntries with Array.map vs new Map with Array.map vs Reduce (reusing object) vs Reduce (creating temporary objects)Fastest: Reduce (reusing object) (130.3x faster)
7,777 ops/sec
1,825 ops/sec
1,244 ops/sec
60 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Object.fromEntries with Array.map | |
| new Map with Array.map | |
| Reduce (reusing object) | |
| Reduce (creating temporary objects) |
| Test name | Executions per second |
|---|---|
| ✓ Reduce (reusing object) | 7,057 Ops/sec |
| Object.fromEntries with Array.map | 3,651 Ops/sec |
| new Map with Array.map | 1,373 Ops/sec |
| Reduce (creating temporary objects) | 0 Ops/sec |