bind vs closure (v30)

Revision 30 of this benchmark created on


Setup

var binder = function(scope, method) {
    return function() {
       return method.apply(scope, arguments);
    }
  };
  
  var self = this;
  var test = function() { return this; }
  
  var test_bind = test.bind(self);
  var test_self = function() { return self; };
  var test_binder = binder(self, test);
  var test_closure = function() { return closure(self, 5); };
  
  function closure(self, v) {
    return self;
  }

Test runner

Ready to run.

Testing in
TestOps/sec
bind()
test_bind();
ready
self
test_self();
ready
closure
test_closure();
ready
binder
test_binder();
ready
call (control)
test.call(this);
ready

Revisions

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