bind vs emulate (v17)

Revision 17 of this benchmark created on


Setup

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

Teardown


    alert(i.i);
  

Test runner

Ready to run.

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

Revisions

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