jQuery.data vs jQuery().data

JavaScript performance comparison

Revision 96 of this test case created by

Preparation code

<script src="http://code.jquery.com/jquery-2.2.0.js"></script>
<div id="el"></div>
<script>
  var i = 0,
      el = document.getElementById('el'),
      $el = $(el);

  $.data(el,'test1','1234567890');
  $el.data('test2','1234567890');
</script>
    

Preparation code output

<div id="el"></div> <script> var i = 0, el = document.getElementById('el'), $el = $(el); $.data(el,'test1','1234567890'); $el.data('test2','1234567890'); </script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
jQuery.data
$.data(el, 'test1');
pending…
jQuery.fn.data
$el.data('test2');
pending…

Compare results of other browsers

Revisions

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

0 Comments