Script Preparation code:
Tests:

Historical Performance Data aggregated from 5 community runs

Desktop Results:
Chrome 5 runs
new RegExp()
13.3M/s
Literal
13.3M/s
new RegExp(Literal)
7.6M/s

Fastest: new RegExp() (1.7x faster)

View exact numbers
  • new RegExp(): 13,313,497 ops/sec
  • Literal: 13,259,180 ops/sec
  • new RegExp(Literal): 7,619,812 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
    new RegExp()
    Literal
    new RegExp(Literal)

    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/135.0.0.0 Safari/537.36
Chrome 135 on Mac OS X 10.15.7
View result in a separate tab
Literal
18.5M/s
new RegExp()
16.4M/s
new RegExp(Literal)
13.4M/s
View exact numbers
Test name Executions per second
Literal 18,518,956 Ops/sec
new RegExp() 16,403,342 Ops/sec
new RegExp(Literal) 13,391,357 Ops/sec