Native bind vs jQuery.proxy vs Underscore bind (v8)

Revision 8 of this benchmark created by Arnial on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js">
</script>

Setup

var t1 = (function(x) {
      return this + x;
    }).bind(1);
    var t2 = jQuery.proxy(function(x) {
      return this + x;
    }, 1);
    var t3 = _.bind(function(x) {
      return this + x;
    }, 1);
    
    var bar = function(x) {
      return this + x;
    };
    var t4 = function(x) { return bar.call(1, x); }

Test runner

Ready to run.

Testing in
TestOps/sec
Native bind
t1(1);
ready
jQuery.proxy
t2(1)
ready
Underscore.js bind
t3(1)
ready
Without bind
t4(1)
ready

Revisions

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