bind vs closure invocation

JavaScript performance comparison

Revision 6 of this test case created

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/dojo/1/dojo/dojo.xd.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.3.0/lodash.min.js"></script>
<script>
var esBind = (function(){ return this }).bind(this);
var closureBind = (function() {
  var self = this;
  return function(){ return self };
})()
var dojoHitch = dojo.hitch(this, function(){ return this });
var lodashBind = _.bind(function () { return this }, this);
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
bind()
esBind();
pending…
self
closureBind();
pending…
dojo.hitch
dojoHitch();
pending…
lodash.bind
lodashBind();
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment