Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15G77
Mobile Safari 11
iOS 11.4.1
Mobile
6 years ago
Test name Executions per second
int*int 4008099.0 Ops/sec
int**2 6181565.5 Ops/sec
Math.pow(int,2) 2938344.0 Ops/sec
float*float 3993457.8 Ops/sec
float**2 6235708.0 Ops/sec
Math.pow(float, 2) 2932977.0 Ops/sec
int*int*int*int*int 1856144.5 Ops/sec
int**5 6090436.5 Ops/sec
Math.pow(int,5) 2909871.5 Ops/sec
float*float*float*float*float 1831038.2 Ops/sec
float**5 6093721.0 Ops/sec
Math.pow(float,5) 2920473.2 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)