call vs apply (v58)

Revision 58 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 obj = new Obj();
    var that = {that: "that"};
    var arg = "arg";
    var arg_array = [arg];

Test runner

Ready to run.

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

Revisions

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