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 604.1 Ops/sec
ES5 replace match map 227.1 Ops/sec
match without replace 313.3 Ops/sec
iteration with replace 177.7 Ops/sec
looping with exec 305.3 Ops/sec
non regex 2696.9 Ops/sec
Script Preparation code:
Tests:
  • original

  • ES5 replace match map

  • match without replace

  • iteration with replace

  • looping with exec

  • non regex