regex vs replaceAllFastest: replaceAll (1.7x faster)
28,532,322 ops/sec
16,331,788 ops/sec
Fastest: regex (1.2x faster)
12,260,242 ops/sec
9,919,049 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| regex | |
| replaceAll |
| Test name | Executions per second |
|---|---|
| ✓ replaceAll | 28,705,628 Ops/sec |
| regex | 16,549,547 Ops/sec |