Reduce vs Filter and join vs Join and replace false vs Join only valid strings vs Reduce but no template string vs Reduce but with optimized parameters vs Push valid to array and join vs Filter and reduce vs Reduce but no leading space vs Reduce but no leading space 2Fastest: Reduce (97.4x faster)
8,582,938 ops/sec
311,479 ops/sec
163,035 ops/sec
151,851 ops/sec
91,683 ops/sec
88,111 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Reduce | |
| Filter and join | |
| Join and replace false | |
| Join only valid strings | |
| Reduce but no template string | |
| Reduce but with optimized parameters | |
| Push valid to array and join | |
| Filter and reduce | |
| Reduce but no leading space | |
| Reduce but no leading space 2 |
| Test name | Executions per second |
|---|---|
| ✓ Reduce but with optimized parameters | 689,849 Ops/sec |
| Reduce but no template string | 392,298 Ops/sec |
| Reduce but no leading space 2 | 326,627 Ops/sec |
| Reduce | 309,222 Ops/sec |
| Reduce but no leading space | 307,326 Ops/sec |
| Filter and reduce | 201,246 Ops/sec |
| Push valid to array and join | 129,384 Ops/sec |
| Join only valid strings | 123,683 Ops/sec |
| Filter and join | 116,750 Ops/sec |
| Join and replace false | 78,562 Ops/sec |