Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 14_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/94.0.4606.76 Mobile/15E148 Safari/604.1
Chrome Mobile iOS 94
iOS 14.7
Mobile
2 years ago
Test name Executions per second
Haversine Classic 949556.6 Ops/sec
Haversine Optimized 2031619.0 Ops/sec
Haversine Mine ATan 1055388.0 Ops/sec
Haversine Mine ASin 1104794.0 Ops/sec
Spherical Law of Cosines 1140553.0 Ops/sec
Equirectangular (a little less accurate) 1742867.0 Ops/sec
Script Preparation code:
Tests:
  • Haversine Classic

  • Haversine Optimized

  • Haversine Mine ATan

  • Haversine Mine ASin

  • Spherical Law of Cosines

  • Equirectangular (a little less accurate)