Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36
Chrome 73
Windows 7
Desktop
5 years ago
Test name Executions per second
$.hasClass 296573.2 Ops/sec
RegExp 1799828.0 Ops/sec
Dry RegExp 532849.5 Ops/sec
indexOf 2131821.2 Ops/sec
classList 1549828.6 Ops/sec
hasClassString 1352730.6 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • $.hasClass

  • RegExp

  • Dry RegExp

  • indexOf

  • classList

  • hasClassString