Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Pierre benchmark
(version: 0)
Benchmark.js
Comparing performance of:
Class vs ID vs data attribute
Created:
3 years ago
by:
Guest
Go to the latest result
HTML Preparation code:
<div class="hello" id="hello" data-hello>Hello</div>
Tests:
Class
document.querySelector('.hello');
ID
document.getElementById('hello');
data attribute
document.querySelector('[data-hello]');
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Class
ID
data attribute
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 years ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Browser/OS:
Chrome 125 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
ID
10.0M/s
Class
7.7M/s
data attribute
5.1M/s
View exact numbers
Test name
Executions per second
✓
ID
10,039,168 Ops/sec
Class
7,696,902 Ops/sec
data attribute
5,095,468 Ops/sec
Related benchmarks
tag VS class
DataAttribute vs Class Selector vs ID Selector vs ~=
DataAttribute vs Class Selector vs ID GetById
Comments
Confirm delete:
Do you really want to delete benchmark?