Run details:
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36 Maxthon/5.3.8.2000
Maxthon 5
Windows 7
Desktop
4 years ago
Test name Executions per second
test 4596169.5 Ops/sec
exec 4145048.8 Ops/sec
match 4165065.5 Ops/sec
indexOf 6872011.0 Ops/sec
Script Preparation code:
AخA
 
var html = "<p>A</p><table><tr><td>1</td><td>2</td></tr></table><p>B</p>";
Tests:
  • test

     
    /<table\b[^>]*>/i.test(html)
  • exec

     
    /<table\b[^>]*>/i.exec(html)
  • match

     
    html.match(/<table\b[^>]*>/i)
  • indexOf

     
    html.toLowerCase().indexOf('<table')