.on() vs. .bind() vs. .delegate(). vs. .native()

Benchmark created by Simon Harte on


Description

What event binding is the most efficient.

Preparation HTML

<a href="#"></a>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Setup

var $link = $('a');

Test runner

Ready to run.

Testing in
TestOps/sec
.on()
$link.on('click', function() {});
ready
.bind()
$link.bind('click', function() {});
ready
.delegate()
$(document).delegate($link, 'click', function() {});
ready
.native()
$link.click(function() {});
ready
.live()
$link.live('click', function() {});
ready
.on() 2
$(document).on('click', $link, function() {});
ready

Revisions

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