$(document).ready() vs $.fn.ready - POINTLESS OPTIMIZATIONS FTW (v2)

Revision 2 of this benchmark created by Patrick Davies on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
  var $d = $(document),
      r = $.fn.ready;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
$(document).ready()
$(document).ready(function() {
 return;
});
ready
cached $document
$d.ready(function() {
 return;
});
ready
$.fn.ready
$.fn.ready(function() {
 return;
});
ready
cached $.fn.ready
r(function() {
 return;
});
ready
$(fn)
$(function() {
 return;
});
ready
$.ready
$.ready(function() {
 return;
});
ready

Revisions

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

  • Revision 1: published by ajpiano on
  • Revision 2: published by Patrick Davies on