GPXIN-6 implemented automatic distance calculations between trackpoints based on changes in Latitude/Longitude.
The original feeling was that this might be un-necessarily processor intensive - in various tests though that doesn't seem to have been the case.
So need to run some additional tests and use the data to decide whether or not distance calculations should be enabled by default (if so, there should be an ability to suppress them).
Activity
2015-08-13 18:04:11
2015-08-27 04:24:10
Created two test scripts - with_calcs.php and without_calcs.php
<?php // without_calcs.php require 'GPXIngest.class.php'; $gpx = new GPXIngest(); $gpx->loadFile('test.gpx'); $gpx->ingest(); print_r($gpx->getGPXNameSpaces()); <?php //with_calcs.php require 'GPXIngest.class.php'; $gpx = new GPXIngest(); $gpx->enableExperimental('calcDistance'); $gpx->loadFile('test.gpx'); $gpx->ingest(); print_r($gpx->getGPXNameSpaces());Test run (not interested in the script output at this point)
ben@milleniumfalcon:~/tmp$ for i in {1..6}; do (time php without_calcs.php > /dev/null) ; done; echo "With:"; for i in {1..6}; do (time php with_calcs.php > /dev/null) ; done; real 0m0.446s user 0m0.417s sys 0m0.028s real 0m0.463s user 0m0.444s sys 0m0.016s real 0m0.442s user 0m0.422s sys 0m0.020s real 0m0.443s user 0m0.420s sys 0m0.020s real 0m0.443s user 0m0.410s sys 0m0.032s real 0m0.445s user 0m0.428s sys 0m0.016s With: real 0m0.492s user 0m0.460s sys 0m0.012s real 0m0.466s user 0m0.450s sys 0m0.016s real 0m0.475s user 0m0.421s sys 0m0.052s real 0m0.459s user 0m0.446s sys 0m0.012s real 0m0.477s user 0m0.432s sys 0m0.044s real 0m0.470s user 0m0.426s sys 0m0.044sWhich gives the following result
So on average, have the calculations enabled required an extra 0.026216667 seconds of calculation.
Per trackpoint (0.026216667/10320) that's a cost of 0.00000254 seconds.
Want to run a few more test runs, with different files and bigger run-sizes, but based on that I can't see any argument against turning the calculations on by default
2015-08-27 04:27:58
2015-08-27 05:11:59
2015-08-27 05:16:09
2015-08-27 05:17:10
ben@milleniumfalcon:~/tmp$ for i in {1..1000}; do echo "$((time php without_calcs.php) |& grep real | cut -f2),$((time php with_calcs.php) |& grep real | cut -f2)," >> processing_times.csv ; done; ben@milleniumfalcon:~/tmp$ less processing_times.csv # quick check to make sure nothing's > 60 seconds ben@milleniumfalcon:~/tmp$ sed -i 's/0m//g' processing_times.csv ben@milleniumfalcon:~/tmp$ sed -i 's/s,/,/g' processing_times.csvI used real time as that's consistently been the highest value.
2015-08-27 05:17:32
So, the overall extra time required to perform the distance calculations is negligible, and in at least one case, the version with calculations ran (marginally) faster.
The test file I'm using represents a journey of more than 3 hours with varied speeds, so there should be a good range of calculations going on.
I'm fairly comfortable with the idea of raising an FR to move calcDistance out of experimental features, so that it's enabled by default (so long as it can be suppressed if needed).
2015-08-27 05:22:13
2015-08-27 05:22:13
2015-08-27 05:22:13
2015-08-27 05:22:16