Run details:
Mozilla/5.0 (Linux; Android 8.1.0; Vibe P1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.58 Mobile Safari/537.36
Chrome Mobile 100
Android 8.1.0
Mobile
2 years ago
Test name Executions per second
replace 4636.6 Ops/sec
replaceAll 6841.1 Ops/sec
replace in a loop without g flag 300.6 Ops/sec
replace in a loop, count matches with g flag, replace without g flag 447.9 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


;