Run details:
Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
Chrome 114
Chrome OS 14541.0.0
Desktop
one year ago
Test name Executions per second
querySelectorAll with .class 237.0 Ops/sec
querySelectorAll with [attribute] 137.1 Ops/sec
filter with classList 22.9 Ops/sec
filter with className 53.9 Ops/sec
filter with getAttribute 44.6 Ops/sec
for with classList 15.1 Ops/sec
for with className 18.7 Ops/sec
for with getAttribute 17.2 Ops/sec
getElementsByClassName 736408.6 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


;