Run details:
Mozilla/5.0 (X11; CrOS x86_64 11895.74.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.90 Safari/537.36
Chrome 74
Chrome OS 11895.74.0
Desktop
5 years ago
Test name Executions per second
RegExp#test 36253876.0 Ops/sec
String#indexOf 630371840.0 Ops/sec
String#match 19413500.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/);