Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Chrome 68
Windows 7
Desktop
6 years ago
Test name Executions per second
int*int 2678864.8 Ops/sec
int**2 4521404.5 Ops/sec
Math.pow(int,2) 1634216.6 Ops/sec
float*float 2939469.0 Ops/sec
float**2 4733045.0 Ops/sec
Math.pow(float, 2) 1833265.6 Ops/sec
int*int*int*int*int 1194031.0 Ops/sec
int**5 5522029.0 Ops/sec
Math.pow(int,5) 1662048.0 Ops/sec
float*float*float*float*float 1120790.4 Ops/sec
float**5 5172459.0 Ops/sec
Math.pow(float,5) 1576405.9 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)