jQuery .data() performance vs .attr() performance (v78)

Revision 78 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<input type="text" id="theInput" value="foo" data-testdata="bar"></input>
<script>
  var theInput = $('#theInput');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Attribute get
theInput.attr('someAttr');
ready
Data get
theInput.data('someData');
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.