bind vs closure invocation

JavaScript performance comparison

Test case created by Kris Zyp

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/dojo/1/dojo/dojo.xd.js"></script>
<script>
var esBind = (function(){ return this }).bind(this);
var self = this;
var closureBind = function(){ return self };
var dojoHitch = dojo.hitch(this, function(){ return 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…

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