trim() vs replace()Fastest: trim() (4.1x faster)
12,313,842 ops/sec
2,995,373 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| trim() | |
| replace() |
| Test name | Executions per second |
|---|---|
| ✓ trim() | 734,192,448 Ops/sec |
| replace() | 1,761,841 Ops/sec |