Array vs Inline Args

Benchmark created on


Setup

function test1 (...args) {
  args.forEach((a) => {
    console.log({ a: a() })
  })
}

function test2 (args) {
  args.forEach((b) => {
    console.log({ b: b() })
  })
}

Test runner

Ready to run.

Testing in
TestOps/sec
Inline Args
test1(() => 1, () => 2, () => 3)
ready
Array Args
test2([() => 1, () => 2, () => 3])
ready

Revisions

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