Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36 SE 2.X MetaSr 1.0
Sogou Explorer 1
Windows
Desktop
2 years ago
Test name Executions per second
original 609.8 Ops/sec
ES5 replace match map 224.5 Ops/sec
match without replace 314.6 Ops/sec
iteration with replace 177.0 Ops/sec
looping with exec 296.4 Ops/sec
non regex 2676.1 Ops/sec
Script Preparation code:
Tests:
  • original

  • ES5 replace match map

  • match without replace

  • iteration with replace

  • looping with exec

  • non regex