Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0
Firefox 113
Windows
Desktop
2 years ago
Test name Executions per second
unneededNonCaptureRE 4288846.5 Ops/sec
noNonCaptureRE 4287936.0 Ops/sec
anotherUnneededNonCapture 5368798.5 Ops/sec
anotherNoNonCapture 7372564.5 Ops/sec
indexOf 914122432.0 Ops/sec
Script Preparation code:
AخA
 
var loremString = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
Tests:
  • unneededNonCaptureRE

     
    /(?:z)+/.exec(loremString)
  • noNonCaptureRE

     
    /z+/.exec(loremString)
  • anotherUnneededNonCapture

     
    /lab(?:o)rum/.exec(loremString)
  • anotherNoNonCapture

     
    /laborum/.exec(loremString)
  • indexOf

     
    loremString.indexOf('laborum')