Destructured param vs params

Benchmark created on


Description

Speed difference between destructuring params vs passing individual params

Setup

function destructuredParams({ a, b, c, d }) {
	console.log(a, b, c, d);
}

function individualParams(a, b, c, d) {
	console.log(a, b, c, d);
}

Test runner

Ready to run.

Testing in
TestOps/sec
Destructured
const a = Math.random();
const b = Math.random();
const c = Math.random();
const d = Math.random();

destructuredParams({ a, b, c, d });
ready
Individual params
const a = Math.random();
const b = Math.random();
const c = Math.random();
const d = Math.random();

individualParams(a, b, c, d);
ready

Revisions

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