Arguments vs. Undefined Check

JavaScript performance comparison

Revision 9 of this test case created


Checks to see if it is worthwhile avoiding arguments.

Preparation code

Benchmark.prototype.setup = function() {
    function testMethod(a, b, c) {
      return a + b + c;
    function variadicBind(method) {
      var context = this;
      return function() {
        var hasE = arguments[4];
        return method.apply(context, arguments);
    function restrictBind(method) {
      var context = this;
      return function(a, b, c, d, e) {
        var hasE = e !== undefined;
        return, a, b, c, d, e);
    var variadicBound = variadicBind(testMethod);
    var restrictBound = restrictBind(testMethod);

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Arguments accessing beyond supplied args
variadicBound(1, 2, 3);
Undefined Check accessing beyond supplied args
restrictBound(1, 2, 3);

Compare results of other browsers


You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:


Comment form temporarily disabled.

Add a comment