replace with global regexp vs replaceAll vs split-joinFastest: split-join (1.6x faster)
6,290,670 ops/sec
5,088,056 ops/sec
4,016,145 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| replace with global regexp | |
| replaceAll | |
| split-join |
| Test name | Executions per second |
|---|---|
| ✓ replace with global regexp | 613,535,872 Ops/sec |
| split-join | 15,065,213 Ops/sec |
| replaceAll | 6,661,378 Ops/sec |