call vs apply (v34)

Revision 34 of this benchmark created on


Setup

function Obj() {
      var that = "that";
    }
    Obj.prototype.target = function(arg) {
      var string = "that: " + this.that + ", arg: " + arg;
      return string;
    };
    var that = {that: "that"};
    var arg = "arg";
    var arg_array = [arg];

Test runner

Ready to run.

Testing in
TestOps/sec
Call
Obj.prototype.target.call(that, arg);
ready
Apply
Obj.prototype.target.apply(that, arg_array);
ready
call.apply
Function.call.apply(Obj.prototype.target, that, arg_array);
ready

Revisions

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