binding

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
without bind
var myObj = {

  specialFunction: function() {

  },

  anotherSpecialFunction: function() {

  },

  getAsyncData: function(cb) {
    cb();
  },

  render: function() {
    var that = this;
    this.getAsyncData(function() {
      that.specialFunction();
      that.anotherSpecialFunction();
    });
  }
};

myObj.render();
ready
with bind
var myObj = {

  specialFunction: function() {

  },

  anotherSpecialFunction: function() {

  },

  getAsyncData: function(cb) {
    cb();
  },

  render: function() {

    this.getAsyncData(function() {

      this.specialFunction();

      this.anotherSpecialFunction();

    }.bind(this));

  }
};

myObj.render();
ready

Revisions

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