bind vs closure (v32)

Revision 32 of this benchmark created by Aria Stewart (@aredridel) on


Setup

foo = {};
    foo.setup = function () { 
      obj = {};
      var self = this;
      obj.closure = function() {
         return self;
      };
      obj.direct = function () {
         return this;
      };
  
      obj.bound = obj.direct.bind(this);
  
      return obj;
    };
  
    var x = foo.setup();

Test runner

Ready to run.

Testing in
TestOps/sec
call
x.direct.call(foo);
ready
bind()
x.bound() == foo;
ready
closure
x.closure() == foo;
ready

Revisions

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