function calls: direct vs apply vs call vs bind (v14)

Revision 14 of this benchmark created by drkibitz on


Setup

function f() {
      return this;
  }
  var that = {
      f: f
  };
  var bound = f.bind(that);
  var that2 = Object.create(that);
  var that3 = {};
  var that4 = Object.create(that3);

Test runner

Ready to run.

Testing in
TestOps/sec
direct
that.f();
ready
apply
f.apply(that);
ready
call
f.call(that);
ready
bind
bound();
ready
direct (dynamic property)
that3.f = f; that3.f();
ready
prototype
that2.f();
ready
prototype (dynamic property)
that3.f = f; that4.f();
ready

Revisions

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