Run details:
Mozilla/5.0 (Linux; Android 8.1.0; ONEPLUS A6003 Build/OPM1.171019.011) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.91 Mobile Safari/537.36
Chrome Mobile 68
Android 8.1.0
Mobile
6 years ago
Test name Executions per second
RegExp#test 19801684.0 Ops/sec
String#indexOf 868627456.0 Ops/sec
String#match 13546172.0 Ops/sec
HTML Preparation code:
AخA
 
1
<div>This is demo</div>
Script Preparation code:
 
console.log("js preparation");
Tests:
  • RegExp#test

     
    /o/.test('Hello World!');
  • String#indexOf

     
    'Hello World!'.indexOf('o') > -1;
  • String#match

     
    !!'Hello World!'.match(/o/);