Cost of creating anonymous function (v3)

Revision 3 of this benchmark created on


Setup

function foo(a, b) {
}

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
Create static curried func in loop
for (let i = 0; i < 100000; i++) {
	const bar = n => foo(123, n)
	bar(Math.random())
}
ready

Revisions

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