Function with 2 params vs 1 object param

Benchmark created on


Description

function twoParams(param1, param2) {} VS function oneParam({ value1, value2}) {}

Setup

const myString = "abcdefgh";
const myNumber = 123456;

function myFunction1(name, age) {
	return `Name: ${name} - Age: ${age}`;
}

function myFunction2({ name, age }) {
	return `Name: ${name} - Age: ${age}`;
}

Test runner

Ready to run.

Testing in
TestOps/sec
2 params
myFunction1(myString, myNumber);
ready
1 object param
myFunction2({ name: myString, age: myNumber });
ready

Revisions

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