Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
DataAttribute vs Class Selector vs ID Selector vs Custom Attributes
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Safari/605.1.15
Browser:
Safari 18
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
9 months ago
Benchmark engine:
Benchmark.js
class
10.4M/s
uid
9.5M/s
id
9.5M/s
data attribute
6.7M/s
View exact numbers
Test name
Executions per second
✓
class
10,409,143 Ops/sec
uid
9,533,746 Ops/sec
id
9,478,637 Ops/sec
data attribute
6,749,745 Ops/sec
HTML Preparation code:
<div class="hello" id="hello" data-hello uid="hello">Hello</div>
Tests:
data attribute
document.querySelector('[data-hello]');
class
document.querySelector('.hello');
id
document.querySelector('#hello');
uid
document.querySelector('[uid="hello"]');