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

Revision 2 of this 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>

Test runner

Ready to run.

Testing in
TestOps/sec
.on() basic
$('a').on('click', function() { return false; });
ready
.on() with delegation
$(document).on('click', 'a', function() {
    return false;
});
ready
.on() with event-map
$(document).on({
    click: function(){
        return false;
    }
}, 'a');
ready
.native()
$('a').click(function() { return false; });
ready
.live()
$('a').live('click', function() { return false; });
ready
.bind()
$('a').bind('click', function() { return false; });
ready
.delegate()
$(document).delegate('a', 'click', function() {
    return false;
});
ready

Revisions

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