bind vs closure (v12)

Revision 12 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/dojo/1/dojo/dojo.xd.js">
</script>
<script>
  function foo() {}
</script>

Setup

function returnThis() {
      return this;
  }

Test runner

Ready to run.

Testing in
TestOps/sec
bind()
var test = (function() {
  return this
}).bind(this);
ready
self
var self = this;
var test = function() {
    return self
    };
ready
dojo.hitch
var test = dojo.hitch(this, function() {
  return this
});
ready
bind() - not anonymous
var test = returnThis.bind(this);
ready

Revisions

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