Math.pow vs. simple multiplication (v7)

Revision 7 of this benchmark created by juloo on


Description

if you only need the cube of something, what will eventually be faster?

Preparation HTML

<p>Hi there, this is math, only. No Output here</p>
<script>
  var x1 = 5, e=0;
  
  function ownCube(num) {
   return num * num * num;
  }

function ownPow(num, exp)
{
while(exp--)
{
num *= num;
}
}
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Simple Multiplication
e = x1 * x1 * x1;
ready
Math.pow
e = Math.pow(x1, 3);
ready
own Cube
e = ownCube(x1);
ready
own Pow
e = ownPow(x1, 3);
ready

Revisions

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