Cost of creating anonymous function

Benchmark created on


Setup

function foo(a, b) {
	(a * b).toString()
}

Test runner

Ready to run.

Testing in
TestOps/sec
Just call func
for (let i = 0; i < 100000; i++) {
	foo(i, Math.random())
}
ready
Create curried func in loop
for (let i = 0; i < 100000; i++) {
	const bar = n => foo(i, n)
	bar(Math.random())
}
ready

Revisions

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