apply vs call vs invoke (v5)

Revision 5 of this benchmark created on


Setup

function fn(a,b,c,d) {return a+b+c+d;}
    var obj = {};

Test runner

Ready to run.

Testing in
TestOps/sec
apply
fn.apply(obj, ['a','b','c','d']);
ready
call
fn.call(obj, 'a', 'b', 'c', 'd');
ready
invoke
eval("fn.call(obj, 'a', 'b', 'c', 'd')");
ready

Revisions

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