call vs apply (v92)

Revision 92 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 myObj = new Obj();

Test runner

Ready to run.

Testing in
TestOps/sec
Call
Obj.prototype.target.call(null,"hi");
ready
Apply
Obj.prototype.target.apply(null,["hi"]);
ready
Indirect call
(0,Obj.prototype.target)("hi")
ready

Revisions

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