Call vs Apply vs Bind

Benchmark created by Kristina Garfinkel on


Setup

var fn = function() {
      return this;
    };
    
    var that = {};
    that.fn = fn;
    
    var fnBind = fn.bind(that);

Test runner

Ready to run.

Testing in
TestOps/sec
direct
that.fn();
ready
direct (local)
fn();
ready
call
fn.call(that);
ready
apply
fn.apply(that);
ready
bind
fnBind();
ready

Revisions

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

  • Revision 1: published by Kristina Garfinkel on
  • Revision 2: published by Esailija on
  • Revision 3: published by GusC on