Tests:

Historical Performance Data aggregated from 27 community runs

Desktop Results:
Chrome 27 runs
string.replace
2.6M/s
regexp.exec
2.0M/s
regexp.matchAll
1.2M/s

Fastest: string.replace (2.1x faster)

View exact numbers
  • string.replace: 2,637,067 ops/sec
  • regexp.exec: 2,020,862 ops/sec
  • regexp.matchAll: 1,238,920 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
    string.replace
    regexp.matchAll
    regexp.exec

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 months ago)
Mozilla/5.0 (X11; Linux x86_64; rv:149.0) Gecko/20100101 Firefox/149.0
Firefox 149 on Linux
View result in a separate tab
string.replace
5.8M/s
regexp.exec
4.9M/s
regexp.matchAll
2.8M/s
View exact numbers
Test name Executions per second
string.replace 5,812,066 Ops/sec
regexp.exec 4,916,916 Ops/sec
regexp.matchAll 2,778,618 Ops/sec