loops (v4)

Revision 4 of this benchmark created on


Setup

const array = new Array(100000);

Test runner

Ready to run.

Testing in
TestOps/sec
imperative
for(let i=0; i < array.length; i++) {
	let thing = Math.pow(i, 10);
	thing = Math.pow(thing, 2);
	thing = Math.round(thing);
	array[i] = thing;
}
ready
functional
for(let i=0; i < array.length; i++) {
	array[i] = Math.pow(i, 10);
}

const array2 = new Array(100000);
for(let i=0; i < array.length; i++) {
	array2[i] = Math.pow(array[i], 2);
}

const array3 = new Array(100000);
for(let i=0; i < array.length; i++) {
	array3[i] = Math.round(array2[i]);
}
ready

Revisions

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