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

Revision 10 of this benchmark created 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.4.2/underscore-min.js">
</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/0.8.1/lodash.min.js">
</script>
<script>
  var lodash = _.noConflict();
</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 t5 = lodash.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
lodash
t5(1)
ready

Revisions

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