Script Preparation code:
Tests:

Historical Performance Data aggregated from 6 community runs

Desktop Results:
Chrome 6 runs
Replace
12.2M/s
ReplaceAll
9.4M/s
Substr
9.2M/s
Slice
9.1M/s
Substring
8.9M/s

Fastest: Replace (1.4x faster)

View exact numbers
  • Replace: 12,154,564 ops/sec
  • ReplaceAll: 9,398,083 ops/sec
  • Substr: 9,242,878 ops/sec
  • Slice: 9,129,214 ops/sec
  • Substring: 8,894,811 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    Substring
    Slice
    Substr
    Replace
    ReplaceAll

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Chrome 131 on Mac OS X 10.15.7
View result in a separate tab
Substr
17.3M/s
Substring
17.3M/s
Slice
17.2M/s
Replace
16.4M/s
ReplaceAll
12.7M/s
View exact numbers
Test name Executions per second
Substr 17,341,842 Ops/sec
Substring 17,266,220 Ops/sec
Slice 17,243,420 Ops/sec
Replace 16,427,916 Ops/sec
ReplaceAll 12,698,046 Ops/sec