HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString

  • indexOf more than operator

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    $.hasClass
    RegExp
    Dry RegExp
    indexOf
    classList
    hasClassString
    indexOf more than operator

    Fastest: N/A

    Slowest: N/A

Get performance results from real users on your website with Request Metrics.
Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4133.0 Safari/537.36 Edg/84.0.508.0
Chrome 84 on Windows
View result in a separate tab
Test name Executions per second
$.hasClass 786190.6 Ops/sec
RegExp 3424062.0 Ops/sec
Dry RegExp 1154993.0 Ops/sec
indexOf 4177221.0 Ops/sec
classList 3525023.0 Ops/sec
hasClassString 2540449.0 Ops/sec
indexOf more than operator 4210654.0 Ops/sec