Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Chrome 111
Linux
Desktop
one year ago
Test name Executions per second
RegEx.test 14272136.0 Ops/sec
String.includes 33059770.0 Ops/sec
Script Preparation code:
AخA
 
var string = "Hello world!";
var regExp = RegExp('hello', 'i');
Tests:
  • RegEx.test

     
    regExp.test(string);
  • String.includes

     
    string.toLowerCase().includes("hello");