math-pow (v2)

Revision 2 of this benchmark created on


Description

Testing different ways to exponentiate

Setup

function pow(num, expo){
    while(--expo){num *= num;}
    return num;
}

let a = 12.43
let power = 2
let b;

Test runner

Ready to run.

Testing in
TestOps/sec
Math.pow
while(power<150){
	b = Math.pow(a,power)
	power++;
}
ready
Multiplication
while(power<150){
	b = pow(a,power)
	power++;
}
ready
Exponentiation operator
while(power<150){
	b = a**power
	power++;
}
ready

Revisions

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