Script Preparation code:
AخA
 
var string = 'test the test {message} test test test test message test test message test test test test test test message'
var regExp = new RegExp('{message}');
Tests:
  • replace by regex

     
    var res = string.replace(regExp, '.')
  • replace via string

     
    var res = string.replace('{message}', '.');
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    replace by regex
    replace via string

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 27 days ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Chrome 135 on Windows
View result in a separate tab
Test name Executions per second
replace by regex 30516674.0 Ops/sec
replace via string 38268836.0 Ops/sec