Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
DataAttribute vs Class Selector vs ID GetById
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0
Browser:
Firefox 115
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
ID
4.8M/s
Class
2.7M/s
data attribute
1.7M/s
View exact numbers
Test name
Executions per second
✓
ID
4,770,620 Ops/sec
Class
2,695,802 Ops/sec
data attribute
1,674,146 Ops/sec
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]');