Immutable.Set union vs Convert JS Set to array, construct new Set vs Array.from, construct new SetFastest: Array.from, construct new Set (2.1x faster)
17,514 ops/sec
15,970 ops/sec
8,424 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Immutable.Set union | |
| Convert JS Set to array, construct new Set | |
| Array.from, construct new Set |
| Test name | Executions per second |
|---|---|
| ✓ Array.from, construct new Set | 13,985 Ops/sec |
| Convert JS Set to array, construct new Set | 12,857 Ops/sec |
| Immutable.Set union | 5,330 Ops/sec |