Run details:
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
Windows
Desktop
4 years ago
Test name Executions per second
$.hasClass 786190.6 Ops/sec
RegExp 3424062.2 Ops/sec
Dry RegExp 1154993.4 Ops/sec
indexOf 4177220.5 Ops/sec
classList 3525022.8 Ops/sec
hasClassString 2540448.8 Ops/sec
indexOf more than operator 4210653.5 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString

  • indexOf more than operator