Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
ID vs set data attribute
(version: 1)
Comparing performance of:
ID vs data attribute
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
const element = document.createElement('div');
Tests:
ID
element.id = 'id';
data attribute
element.setAttribute('data-id', 'id');
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
ID
data attribute
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
4 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0
Browser/OS:
Chrome 143 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
ID
20873992.0 Ops/sec
data attribute
8607611.0 Ops/sec
Related benchmarks:
id vs setAttribute
Set ID
setAttribute vs type
Dataset vs getAttribute vs Property v2
getAttribute('data-foo') vs dataset.foo
Set number value as string attribute
Dataset vs getAttribute vs Property v2.1
id vs getAttribute
js - title vs setAttribute /2
Comments
Confirm delete:
Do you really want to delete benchmark?