Creating a function vs calling it

Benchmark created on


Setup

function foo() {
	return Math.random();
}

function bar() {
	return foo();
}

function baz() {
	return bar();
}

Test runner

Ready to run.

Testing in
TestOps/sec
Running
baz();
ready
Creating
function qux() {
	return foo();
}
qux();
ready
Anonymous IIFE
(() => foo())();
ready

Revisions

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