bind vs emulate

Benchmark created on


Setup

var emulatebind = function (f, context) {
      return function () {
        f.apply(context, 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.