Run details:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36
Chrome Mobile 114
Android
Mobile
one year ago
Test name Executions per second
querySelectorAll with .class 535.5 Ops/sec
querySelectorAll with [attribute] 190.6 Ops/sec
filter with classList 18.7 Ops/sec
filter with className 56.0 Ops/sec
filter with getAttribute 53.1 Ops/sec
for with classList 14.9 Ops/sec
for with className 19.4 Ops/sec
for with getAttribute 18.7 Ops/sec
getElementsByClassName 589726.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