Script Preparation code:
AخA
 
var str = "this is a test"
Tests:
  • Regex

     
    str.match(/^..._(?:BASE|PRO)$/)
  • endsWith

     
    str.endsWith("_BASE") || str.endsWith("_PRO")
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Regex
    endsWith

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Chrome 121 on Windows
View result in a separate tab
Test name Executions per second
Regex 16229662.0 Ops/sec
endsWith 11913984.0 Ops/sec