Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0
Firefox 133
Ubuntu
Desktop
one year ago
getElementsByClassName
2.3M/s
querySelectorAll with .class
765/s
querySelectorAll with [attribute]
492/s
filter with getAttribute
281/s
filter with className
247/s
filter with classList
195/s
for with getAttribute
76/s
for with className
70/s
for with classList
54/s
View exact numbers
Test name Executions per second
getElementsByClassName 2,311,767 Ops/sec
querySelectorAll with .class 765 Ops/sec
querySelectorAll with [attribute] 492 Ops/sec
filter with getAttribute 281 Ops/sec
filter with className 247 Ops/sec
filter with classList 195 Ops/sec
for with getAttribute 76 Ops/sec
for with className 70 Ops/sec
for with classList 54 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests: