Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120
Windows
Desktop
10 months ago
Test name Executions per second
data attribute 871830.8 Ops/sec
class name 1411892.2 Ops/sec
HTML Preparation code:
AخA
 
1
<div class="test" data-attribute="test"></div>
2
<div class="test" data-attribute="test"></div>
3
<div class="test" data-attribute="test"></div>
4
<div class="test" data-attribute="test"></div>
5
<div class="test" data-attribute="test"></div>
6
<div class="test" data-attribute="test"></div>
7
<div class="test" data-attribute="test"></div>
8
<div class="test" data-attribute="test"></div>
9
<div class="test" data-attribute="test"></div>
10
<div class="test" data-attribute="test"></div>
11
<div class="test" data-attribute="test"></div>
12
<div class="test" data-attribute="test"></div>
13
<div class="test" data-attribute="test"></div>
14
<div class="test" data-attribute="test"></div>
15
<div class="test" data-attribute="test"></div>
16
<div class="test" data-attribute="test"></div>
17
<div class="test" data-attribute="test"></div>
18
<div class="test" data-attribute="test"></div>
19
<div class="test" data-attribute="test"></div>
20
<div class="test" data-attribute="test"></div>
21
<div class="test" data-attribute="test"></div>
22
<div class="test" data-attribute="test"></div>
23
<div class="test" data-attribute="test"></div>
24
<div class="test" data-attribute="test"></div>
Tests:
  • data attribute

     
    var test = document.querySelectorAll('[data-attribute="test"]');
  • class name

     
    var test = document.querySelectorAll('.test');