Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Chrome 102
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
className const regex 5788673.5 Ops/sec
className cached regex 3976302.2 Ops/sec
className new regex 2084503.8 Ops/sec
classList contains 5763761.5 Ops/sec
className split includes 1927592.2 Ops/sec
className indexOf scan 5942290.5 Ops/sec
Script Preparation code:
Tests:
  • className const regex

  • className cached regex

  • className new regex

  • classList contains

  • className split includes

  • className indexOf scan