jQuery.data vs jQuery().data (v39)

Revision 39 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="el"></div>
<script>
  var i = 0,
      el = document.getElementById('el'),
      $el = $(el);
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery.data on el
$.data(el, 'key-' + Math.floor(Math.random() * 1001), 'val-' + Math.floor(Math.random() * 1001));
ready
jQuery.data on $el
$.data($el, 'key-' + Math.floor(Math.random() * 1001), 'val-' + Math.floor(Math.random() * 1001));
ready
jQuery.data on $el[0]
$.data($el[0], 'key-' + Math.floor(Math.random() * 1001), 'val-' + Math.floor(Math.random() * 1001));
ready

Revisions

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