Leaking arguments

JavaScript performance comparison

Test case created by

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  function otherFunc(a, b) {
    return a + b;
  }
  
  function withArguments(x) {
    var a = arguments;
    return otherFunc.apply(x, Array.prototype.slice.call(a, 1));
  }
  
  function withCopy(x) {
    var a = [];
    var i, len = arguments.length;
    for (i = 1; i < len; i += 1) {
      a[i - 1] = arguments[i];
    }
    return otherFunc.apply(x, a);
  }

};
</script>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
With arguments, 2 args
withArguments(1, 2);
pending…
With copy, 2 args
withCopy(1, 2);
pending…
With arguments, 9 args
withArguments(1, 2, 3, 4, 5, 6, 7, 8, 9);
pending…
With copy, 9 args
withCopy(1, 2, 3, 4, 5, 6, 7, 8, 9);
pending…

Compare results of other browsers

Revisions

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

0 Comments