Run details:
Mozilla/5.0 (Linux; Android 9; ANE-LX1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.87 Mobile Safari/537.36
Chrome Mobile 98
Android
Mobile
2 years ago
Test name Executions per second
replace 13118.8 Ops/sec
replaceAll 13539.8 Ops/sec
replace in a loop without g flag 602.4 Ops/sec
replace in a loop, count matches with g flag, replace without g flag 862.3 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