call vs apply arguments (v56)

Revision 56 of this benchmark created on


Setup

function Obj() {
      this.that = this;
    }
    Obj.prototype.target = function(arg) {
      var string = "that: " + this.that + ", arg: " + arg;
      return string;
    };
    
    var arg = "arg";
    
    var doCall = function(arg1) {
      Obj.prototype.target.call(this, arg1);
    };
    
    var doApply = function() {
      Obj.prototype.target.apply(this, arguments);
    };

Test runner

Ready to run.

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

Revisions

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