pow 2

Benchmark publishedon

Setup

const arr = new Array(100000);
for (let i=0; i< arr.length; i++) {
	arr[i] = Math.round(Math.random() * 100000);
}
function mul(x) {
	return x * x;
}

Test Runner

Initializing...

Testing in
Test CaseOps/sec
mul
const arr1 = new Array(arr.length);
for (let i=0; i< arr.length; i++) {
	arr1[i] = arr[1] * arr[i];
}
ready
f mul
const arr2 = new Array(arr.length);
for (let i=0; i< arr.length; i++) {
	arr2[i] = mul(arr[1]);
}
ready
pow
const arr3 = new Array(arr.length);
for (let i=0; i< arr.length; i++) {
	arr3[i] = Math.pow(arr[1], 2);
}
ready

Revisions

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

Revision 1
publishedon
Revision 2
publishedon