zepto .data() performance vs .attr() performance (v89)

Revision 89 of this benchmark created by kidney on


Preparation HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.1.3/zepto.min.js"></script>
<input type="text" id="theInput" value="foo"></input>
<script>
  var theInput = $('#theInput');
  theInput.attr('someAttr', 'theValue').data('someData', 'theValue');
</script>

Test runner

Ready to run.

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

Revisions

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