wiki:DistCalcs

Distance Calculation Comparison

This is a comparison between the two methods of distance calculations in OpenSHA.

The two options (both in LocationUtils.java are linearDistance (referred to as "slow") and linearDistanceFast (referred to as "fast").

Test conducted with this class: 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
distancedist delta (fast - slow)percent difference
50 KM1.28E-04 KM2.57E-04 %
100 KM0.001026994 KM0.001027005 %
200 KM0.008215952 KM0.004108145 %
500 KM0.128369704 KM0.025680531 %
1000 KM1.026777967 KM0.102783287 %
2000 KM8.207860832 KM0.412083308 %
3000 KM27.66526207 KM0.930752669 %
4000 KM65.46170846 KM1.663744154 %
5000 KM127.6116548 KM2.61896699 %

Charts

Total cumulative calculation time over iterations

Distance delta (fast distance - slow distance) vs calculation distance

Percent difference between fast and slow methods vs calculation distance

Last modified 13 years ago Last modified on Nov 4, 2010, 1:33:26 PM

Attachments (4)

Download all attachments as: .zip