= Distance Calculation Comparison = This is a comparison between the two methods of distance calculations in OpenSHA. The two options (both in [source:trunk/src/org/opensha/commons/geo/LocationUtils.java LocationUtils.java] are linearDistance (referred to as "slow") and linearDistanceFast (referred to as "fast"). Test conducted with this class: [source:trunk/dev/scratch/kevin/DistSpeedTest.java] For full results, see attachment dist_calc_comparison.xlsx == Test Results == * Distance calculations: 5000000 * Distance range: 0.001 KM -> 5000 KM, 0.001 KM increments from starting location with azimuth of 45 degrees. * Total times * Fast: 5463 milis = 5.463 secs (0.0010926 milis/calc) * Slow: 7410 milis = 7.410 secs (0.001482 milis/calc) * Speedup: 1.356397583745195 x ||distance||dist delta (fast - slow)||percent difference|| ||50 KM||1.28E-04 KM||2.57E-04 %|| ||100 KM||0.001026994 KM||0.001027005 %|| ||200 KM||0.008215952 KM||0.004108145 %|| ||500 KM||0.128369704 KM||0.025680531 %|| ||1000 KM||1.026777967 KM||0.102783287 %|| ||2000 KM||8.207860832 KM||0.412083308 %|| ||3000 KM||27.66526207 KM||0.930752669 %|| ||4000 KM||65.46170846 KM||1.663744154 %|| ||5000 KM||127.6116548 KM||2.61896699 %|| == Charts == === Total cumulative calculation time over iterations === [[Image(dist_calc_time_chart.png)]] === Distance delta (fast distance - slow distance) vs calculation distance === [[Image(fast_minus_slow_chart.png)]] === Percent difference between fast and slow methods vs calculation distance === [[Image(percent_diff_chart.png)]]