Run details:
Mozilla/5.0 (Android 6.0; Mobile; rv:102.0) Gecko/102.0 Firefox/102.0
Firefox Mobile 102
Android 6.0
Mobile
2 years ago
Test name Executions per second
querySelectorAll with .class 22.6 Ops/sec
querySelectorAll with [attribute] 11.7 Ops/sec
filter with classList 5.6 Ops/sec
filter with className 8.4 Ops/sec
filter with getAttribute 9.4 Ops/sec
for with classList 3.1 Ops/sec
for with className 3.9 Ops/sec
for with getAttribute 3.9 Ops/sec
getElementsByClassName 132163.5 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