Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36
Chrome 68
Windows
Desktop
6 years ago
Test name Executions per second
int*int 4432760.0 Ops/sec
int**2 7896167.0 Ops/sec
Math.pow(int,2) 2484267.0 Ops/sec
float*float 4357056.0 Ops/sec
float**2 7815215.5 Ops/sec
Math.pow(float, 2) 2480090.0 Ops/sec
int*int*int*int*int 1713059.9 Ops/sec
int**5 7934245.5 Ops/sec
Math.pow(int,5) 2455406.5 Ops/sec
float*float*float*float*float 1694040.1 Ops/sec
float**5 7918369.0 Ops/sec
Math.pow(float,5) 2482611.5 Ops/sec
Script Preparation code:
Tests:
  • int*int

  • int**2

  • Math.pow(int,2)

  • float*float

  • float**2

  • Math.pow(float, 2)

  • int*int*int*int*int

  • int**5

  • Math.pow(int,5)

  • float*float*float*float*float

  • float**5

  • Math.pow(float,5)