Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 Firefox/100.0
Firefox 100
Mac OS X 10.15
Desktop
2 years ago
Test name Executions per second
replace 129041.3 Ops/sec
replaceAll 114029.4 Ops/sec
replace in a loop without g flag 4355.9 Ops/sec
replace in a loop, count matches with g flag, replace without g flag 7180.4 Ops/sec
Script Preparation code:
Tests:
  • replace

  • replaceAll

  • replace in a loop without g flag

  • replace in a loop, count matches with g flag, replace without g flag