Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Chrome 68
Linux
Desktop
6 years ago
Test name Executions per second
int*int 5313469.5 Ops/sec
int**2 9912964.0 Ops/sec
Math.pow(int,2) 3094293.2 Ops/sec
float*float 5534535.5 Ops/sec
float**2 9874090.0 Ops/sec
Math.pow(float, 2) 3142062.2 Ops/sec
int*int*int*int*int 2055442.5 Ops/sec
int**5 9690017.0 Ops/sec
Math.pow(int,5) 3452776.2 Ops/sec
float*float*float*float*float 2669503.5 Ops/sec
float**5 12549440.0 Ops/sec
Math.pow(float,5) 4195024.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)