bind vs emulate (v33)

Revision 33 of this benchmark created by m93a on


Setup

var emulatebind = function (f, context) {
      args = Array.splice(arguments,2);
      return function () {
        f.apply(context, args.concat(arguments));
      };
    };
    
    var i = { i: 0 };
    
    var f = function () {
      this.i++;
    };
    
    var binded = f.bind(i);
    var emulated = emulatebind(f, i);

Test runner

Ready to run.

Testing in
TestOps/sec
bind
binded();
ready
emulate
emulated();
ready

Revisions

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