Is $.proxy really worth it? (v2)

Revision 2 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script><div>module method click me!</div>

Test runner

Ready to run.

Testing in
TestOps/sec
with proxy
var $div = $('div');
var myMethod = function(e) {
 console.log('with___');
};
var init = function() {
 $div.mousedown($.proxy(myMethod, this)).trigger('mousedown');
};
init();
ready
without proxy
var $div = $('div');
var myMethod = function(e) {
 console.log('without');
};
var init = function() {
 $div.mousedown(myMethod).trigger('mousedown');
};
init();
ready

Revisions

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