fcd_vs_bind (v19)

Revision 19 of this benchmark created on


Setup

$$fcb = function(instance, method, contextArgs) {
      contextArgs = Array.prototype.slice.call(arguments, 2);
      var wrapper = function fcb() {
        var invocationArgs = contextArgs.slice(0);
        for (var i = 0; i < arguments.length; i++) {
          invocationArgs.push(arguments[i]);
        }
        return method.apply(instance, invocationArgs);
      };
      return wrapper;
    };
    
    testFunction = function(ctxArg, invArg) {
      return this.MyProp + ctxArg - invArg;
    };
    
    Obj = {
      MyProp: 2
    };
    fcbFunction = $$fcb(Obj, testFunction, 5);
    boundFunction = testFunction.bind(Obj, 5);

Test runner

Ready to run.

Testing in
TestOps/sec
fcd
fcbFunction();
ready
bind
boundFunction();
ready

Revisions

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