Run details:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Mobile Safari/537.36
Chrome Mobile 117
Android
Mobile
11 months ago
Test name Executions per second
replace 103354.7 Ops/sec
replaceAll 103957.8 Ops/sec
replace in a loop without g flag 4553.8 Ops/sec
replace in a loop, count matches with g flag, replace without g flag 6639.5 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