bind vs scope

Benchmark created by Elie Rotenberg on


Setup

Function.prototype.scope = function(ctx) {
    var fn = this;
    return function() {
      return fn.apply(ctx, arguments);
    };
  };
  
  var A = {
    a: null,
    f: function() {
      this.a = 1;
    },
  };
  
  var fBind = A.f.bind(A);
  var fScope = A.f.scope(A);

Test runner

Ready to run.

Testing in
TestOps/sec
bind
fBind();
ready
scope
fScope();
ready

Revisions

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