Run details:
Mozilla/5.0 (iPad; CPU OS 9_3_4 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G35 Safari/601.1
Mobile Safari 9
iOS 9.3.4
iPad
8 years ago
Test name Executions per second
original 220.9 Ops/sec
ES5 replace match map 194.0 Ops/sec
match without replace 258.7 Ops/sec
iteration with replace 112.5 Ops/sec
looping with exec 115.2 Ops/sec
non regex 2905.3 Ops/sec
Script Preparation code:
Tests:
  • original

  • ES5 replace match map

  • match without replace

  • iteration with replace

  • looping with exec

  • non regex