apply vs call vs invoke (v6)

Revision 6 of this benchmark created by Igor Minar on


Setup

var fn = function(a,b,c,d) {return a+b+c+d;},
        obj = {},
        fnBound = fn.bind(obj),
        fnJsBound = jsBind(obj, fn);
    
    function jsBind(self, fn) {
      return function() {
        return arguments.length
           ? fn.apply(self, arguments)
           : fn.call(self);
       };
    }

Test runner

Ready to run.

Testing in
TestOps/sec
bind (native)
fnBound('a','b','c','d');
ready
bind (js)
fnJsBound('a','b','c','d');
ready

Revisions

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