Lodash uniqBy vs new Set() Destructuring vs uniq for loop vs uniq by forEach vs uniq by filterFastest: uniq for loop (11.4x faster)
5,750 ops/sec
4,068 ops/sec
2,467 ops/sec
862 ops/sec
506 ops/sec
Fastest: uniq for loop (93.3x faster)
9,166 ops/sec
3,911 ops/sec
2,873 ops/sec
185 ops/sec
98 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Lodash uniqBy | |
| new Set() Destructuring | |
| uniq for loop | |
| uniq by forEach | |
| uniq by filter |
| Test name | Executions per second |
|---|---|
| ✓ uniq for loop | 13,934 Ops/sec |
| Lodash uniqBy | 4,644 Ops/sec |
| new Set() Destructuring | 2,045 Ops/sec |
| uniq by forEach | 934 Ops/sec |
| uniq by filter | 515 Ops/sec |