replace regex vs replace All vs split&joinFastest: split&join (2.8x faster)
11,266,885 ops/sec
10,357,370 ops/sec
3,968,674 ops/sec
Fastest: split&join (2.9x faster)
8,872,054 ops/sec
7,258,580 ops/sec
3,082,716 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| replace regex | |
| replace All | |
| split&join |
| Test name | Executions per second |
|---|---|
| ✓ replace regex | 2,334,376 Ops/sec |
| split&join | 2,026,891 Ops/sec |
| replace All | 1,121,608 Ops/sec |