Passing parameters directly vs. Param Object

JavaScript performance comparison

Revision 18 of this test case created by Max Pixel

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var X = 1;
  var Y = 2;
  var Z = 3;
  var A = 4;
  var B = 5;
  var C = 6;
  
  function fnParamObject({x,y,z,a,b,c}){
  var res = (x+y)*z*c/(b-a);
  };
  
  function fnParamParam(x,y,z,a,b,c){
  var res = (x+y)*z*c/(b-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
Object
fnParamObject({x:X, y:Y, z:Z, a:A, b:B, c:C});
pending…
Parameters
fnParamParam(X, Y, Z, A, B, C);
pending…

Revisions

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

0 Comments