If revised

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Classique
function if_classique(condition, fn1, fn2) {
	if(condition) {
		return fn1()
	} else {
		return fn2()
	}
}

if_classique(1 === 1, () => console.log('top'), () => console.log('down'))
ready
Revised
function if_revised(condition, fn1, fn2) {
	 return {true: ifTrueFn,false: ifFalseFn}[condition]();
}

if_revised(1 === 1, () => console.log('top'), () => console.log('down'))
ready

Revisions

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