Functions inside or outside?

Benchmark created on


Setup

const funIn = (a, b) => {
	const sum = (a, b) => a + b;
	return sum(a, b);
}

const sum = (a, b) => a + b;
const funOut = (a, b) => sum(a, b);

Test runner

Ready to run.

Testing in
TestOps/sec
Inside
funIn(Math.random() * 1000, Math.random() * 1000);
ready
Outside
funOut(Math.random() * 1000, Math.random() * 1000);
ready

Revisions

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