Function parameters vs Arguments object

JavaScript performance comparison

Revision 3 of this test case created


Compare performance of using 'arguments' object or function parameters

Preparation code

Benchmark.prototype.setup = function() {
    argFunc = function () {
    this.a = arguments[0];
    this.b = arguments[1];
    this.c = arguments[2];
    paramFunc = function (aParam, bParam, cParam) {
    this.a = aParam;
    this.b = bParam;
    this.c = cParam;
    cacheArgFunc = function () {
    var arg = arguments;
    this.a = arg[0];
    this.b = arg[1];
    this.c = arg[2];

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 object
new argFunc ('ParamA', 77, true);
Function parameters
new paramFunc('ParamA', 77, true);
Cached Arguments Object
new cacheArgFunc('ParamA', 77, true);

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