call vs apply (v57)

Revision 57 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
regular
Obj.prototype.target(arg)
ready

Revisions

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