Sequential exponentiation by 2 and 3

Benchmark created on


Setup

const N = 1000000;
const numbers = new Float32Array(N).map(() => Math.random());
const results2 = new Float32Array(N);
const results3 = new Float32Array(N);

Test runner

Ready to run.

Testing in
TestOps/sec
Exponentiation (**)
for (let i = 0; i < N; i++) {
	const v = numbers[i];
	results3[i] = v ** 3;
	results2[i] = v ** 2;
}
ready
Repeated multiplication
for (let i = 0; i < N; i++) {
	const v = numbers[i];
	const e2 = v * v;
	results3[i] = e2 * v;
	results2[i] = e2;
}
ready

Revisions

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