BasicAirData / GPSLogger

A GPS logger for Android mobile devices
http://www.basicairdata.eu/projects/android/android-gps-logger/
GNU General Public License v3.0
401 stars 126 forks source link

Exporter - DB query, String building, and SD write task in 3 separated threads #21

Closed GrazianoCapelli closed 7 years ago

GrazianoCapelli commented 7 years ago

In order to speedup the exportation process, should be fine to split the 3 macro tasks of the exporter into 3 separated threads.

Thread 1 = Performs DB queries and populates the lists (a BlockingQueue) of Location items; Thread 2 = Reads Location items from the list, builds strings for output file(s) and puts them into one list for each file format; Thread 3 = Reads strings from the string list(s) and write file(s);

I tried to split DB queries from the rest of exportation process a couple of months ago, and I found a noticeable performance improvement. The downside was the memory usage: the exportation was more memory hungry.

GrazianoCapelli commented 7 years ago

First benchmark tests on my real hardware show the following increment in performance:

Test 1 1 track into DB (KML + GPX + TXT with EGM active, no GPS fixes, attached with debug) +19% (Share, Exportation), +58% (View)

Test 2 30 tracks into DB (KML + GPX + TXT with EGM active, no GPS fixes, attached with debug) +35% (Share, Exportation), +81% (View)

Thus, the solution performs very well also when the DB grows. Several tests will be made before the inclusion in the next release.