Run details:
Mozilla/5.0 (Android 11; Mobile; rv:103.0) Gecko/103.0 Firefox/103.0
Firefox Mobile 103
Android
Mobile
2 years ago
Test name Executions per second
Multiple, regex 3701723.5 Ops/sec
Single, regex 2764366.5 Ops/sec
Single, group regex 2766130.2 Ops/sec
No regex 7257377.5 Ops/sec
Script Preparation code:
AخA
 
var str = "Et inventore ut est. Illum dolorem similique odit. Velit necessitatibus unde nostrum sequi ut pariatur suscipit sit magnam. Cum esse sed quod aut id. Recusandae vel commodi."
Tests:
  • Multiple, regex

     
    str = str.replace(/a/g, '').replace(/e/g,'')
  • Single, regex

     
    str = str.replace(/a|e/g, '')
  • Single, group regex

     
    str = str.replace(/[ae]+/g, '')
  • No regex

     
    str = str.replace('a', '').replace('e','')