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

Revision 27 of this benchmark created on


Setup

var f = function(){
      return this.x + this.y;
    };
    
    var that = { x: 2, y: 2, ff: f };
    
    var bound = f.bind(that);
    
    var bound2 = function(){
    f.call(that);
    };

Test runner

Ready to run.

Testing in
TestOps/sec
direct
that.ff();
ready
apply
f.apply(that);
ready
call
f.call(that);
ready
bind
bound();
ready
direct2
f(that);
ready
bind2
bound2()
ready

Revisions

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