If vs Cached (v3)

Revision 3 of this benchmark created on


Setup

const repeats = 1e9;
let flag = Math.random() > 0.5;

let counter = 0;

function branch(){
	if(flag)
		++counter;
	else
		--counter;
}

function cacheLE(){
	++counter;
}

function cacheBE(){
	--counter;
}

let cache = flag ? cacheLE : cacheBE;

Test runner

Ready to run.

Testing in
TestOps/sec
Branches
branch();
ready
Cached functions
cache();
ready

Revisions

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