Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
Chrome 114
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
original 2119.0 Ops/sec
ES5 replace match map 831.5 Ops/sec
match without replace 1174.8 Ops/sec
iteration with replace 782.1 Ops/sec
looping with exec 1357.0 Ops/sec
non regex 4733.9 Ops/sec
Script Preparation code:
Tests:
  • original

  • ES5 replace match map

  • match without replace

  • iteration with replace

  • looping with exec

  • non regex