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

Revision 3 of this benchmark created on


Description

What event binding is the most efficient.

Preparation HTML

<a id="test" 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
.on id based
$("#test").on("click",function() {
    return false;
});
ready

Revisions

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