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

Revision 53 of this benchmark created by test 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
prototype
that2.f();
ready
direct (dynamic property)
that3.f = f; that3.f();
ready
prototype (dynamic property)
that3.f = f; that4.f();
ready
prototype + index notation
that2['f']();
ready

Revisions

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