Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/118.0
Firefox 118
Ubuntu
Desktop
one year ago
Test name Executions per second
querySelectorAll with .class 1180.7 Ops/sec
querySelectorAll with [attribute] 801.3 Ops/sec
filter with classList 169.6 Ops/sec
filter with className 202.9 Ops/sec
filter with getAttribute 299.2 Ops/sec
for with classList 76.4 Ops/sec
for with className 83.9 Ops/sec
for with getAttribute 96.9 Ops/sec
getElementsByClassName 3998382.2 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • querySelectorAll with .class

  • querySelectorAll with [attribute]

  • filter with classList

  • filter with className

  • filter with getAttribute

  • for with classList

  • for with className

  • for with getAttribute

  • getElementsByClassName


;