Function.length performance

JavaScript performance comparison

Revision 8 of this test case created by Evan Borden

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  function named (x, y) {
    return x + y;
  }
  var func = function (x, y) {
   return x + y;
  },
  vanilla = function (func) {
   return func(1, 2);
  },
  length = function (func) {
   func.length;
   return func(1, 2);
  };

};

Benchmark.prototype.teardown = function() {
  named = null;
  func = null;
  vanilla = null;
  length = null;

};
</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
Vanilla Var Function
vanilla(func);
pending…
Length Var Function
length(func);
pending…
Vanilla Named Function
vanilla(named);
pending…
Length Named Function
length(named);
pending…
Vanilla Anonymous Function
vanilla(function(a, b){ return a + b; });
pending…
Length Anonymous Function
length(function(a, b){ return a + b; });
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