Multiple function parameters vs parameter object

Benchmark created on


Preparation HTML


Setup

function f1(a, b, c, d, e, f, g) {
  return a + b + c + d + e + f + g;
}

function f2(p) {
  return p.a + p.b + p.c + p.d + p.e + p.f + p.g;
}

Test runner

Ready to run.

Testing in
TestOps/sec
Explicit parameters
f1(1, 2, 3, 4, 5, 6, Math.random());
ready
New parameter object
f2({ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: Math.random()});
ready

Revisions

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