Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Modern dataset vs old .getAttribute() vs jQuery .data() vs jQuery .attr()
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 132
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
dataset
1371112.4 Ops/sec
getAttribute
1373817.8 Ops/sec
jQuery .data()
23130.6 Ops/sec
jQuery .attr()
25412.3 Ops/sec
HTML Preparation code:
<h3 id="data" data-test="text">kipr202 header</h3> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script>
Tests:
dataset
window.onload = function() { document.querySelector("h3#data").dataset.test; }
getAttribute
window.onload = function() { document.querySelector("h3#data").getAttribute("test"); }
jQuery .data()
$(document).ready(function() { $("h3#data").data("test"); });
jQuery .attr()
$(document).ready(function() { $("h3#data").attr("data-test"); });