Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
Chrome 133
Windows
Desktop
one year ago
getElementsByClassName
2.9M/s
querySelectorAll with .class
284/s
querySelectorAll with [attribute]
283/s
for with className
124/s
filter with className
118/s
for with getAttribute
93/s
filter with getAttribute
87/s
for with classList
70/s
filter with classList
64/s
View exact numbers
Test name Executions per second
getElementsByClassName 2,886,683 Ops/sec
querySelectorAll with .class 284 Ops/sec
querySelectorAll with [attribute] 283 Ops/sec
for with className 124 Ops/sec
filter with className 118 Ops/sec
for with getAttribute 93 Ops/sec
filter with getAttribute 87 Ops/sec
for with classList 70 Ops/sec
filter with classList 64 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests: