jQuery .live() vs .delegate() vs .on() vs bind() (v5)

Revision 5 of this benchmark created by Andrew Smith on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div id="context" style="height:200px; overflow: scroll;">
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
  <p>
    Some paragraph
  </p>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
.live()
$('p').live('click', $.noop);
ready
.live() with context
$('p', '#context').live('click', $.noop);
ready
.delegate()
$('#context').delegate('p', 'click', $.noop);
ready
.delegate() on document
$(document).delegate('p', 'click', $.noop);
ready
.on()
$('#context').on('click', 'p', $.noop);
ready
.on() on document
$(document).on('click', 'p', $.noop);
ready
.bind()
$('p').bind('click', $.noop);
ready
.bind() with context
$('p', '#context').bind('click', $.noop);
ready

Revisions

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