arguments

Benchmark created by Jorge on


Description

arguments vs named parameters this vs that

Preparation HTML

<script>
  function f(x, y) {
   return x + y
  }
  
  function g(x, y) {
   arguments;
   return x + y
  }
  
  function h(x, y) {
   return arguments[0] + arguments[1]
  }
  
  var that = {
   a: 27
  };
  
  that.i = function() {
   return that.a;
  }
  
  
  that.j = function() {
   return this.a;
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
named parameters
var z = f(2, 3) + f(2, 3) + f(2, 3) + f(2, 3) + f(2, 3);
ready
named parameters + args
var z = g(2, 3) + g(2, 3) + g(2, 3) + g(2, 3) + g(2, 3);
ready
arguments
var z = h(2, 3) + h(2, 3) + h(2, 3) + h(2, 3) + h(2, 3);
ready
that
var z = that.i() + that.i() + that.i() + that.i() + that.i();
ready
this
var z = that.j() + that.j() + that.j() + that.j() + that.j();
ready

Revisions

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