jQuery document on vs ready (v10)

Revision 10 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
on()
$(document).on('ready', function() {
  jQuery.noop();
});
ready
ready
$(document).ready(function() {
  jQuery.noop();
});
ready
on(), document in context
$(window).on('ready', document, function() {
  jQuery.noop();
});
ready
ready + an extra on()
$(document).ready(function() {
  $.noop();
}).on('ready', function() {
  $.noop();
});
ready
ready + on, no chaining
$(document).ready(function() {
  $.noop();
});

$(document).on('ready', function() {
  $.noop();
});
ready
ready shorthand
$(function() {
  $.noop();
});
ready
ready shorthand no $
jQuery(function() {
  jQuery.noop();
});
ready

Revisions

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