lbdroid / FFMpeg-DashCam

DashCam recording for Android car radios.
8 stars 4 forks source link

Sluggish loading of logs fragment #14

Closed lbdroid closed 7 years ago

lbdroid commented 7 years ago

Takes an incredibly long time to load the logs fragment.

lbdroid commented 7 years ago

Apparently my logging database is several gigabytes long, so the part of the process that is excessively slow is selecting everything in reverse chronological order. The logs are probably excessively long as a result of the same 3rd party library bug I found responsible for https://github.com/lbdroid/FFMpeg-DashCam/issues/12 -- specifically, the constant trying (and failing) to start ffmpeg while it is already running.

I have also implemented an IPC speedup for log loading, which rather than locking the IPC until the previous line has been transferred, will buffer the lines and update the views as they come in. It means that the logs fragment loads in a "chunky" manner, but transfers faster.

lbdroid commented 7 years ago

Improved FIXED in 1.0.3

The biggest delay now, is the actual select from the database, and will be because I'm sorting the log in reverse order of time (newest line on top), and in sqlite, time is stored in a TEXT column, which can't be sorted very efficiently.

I think what I'll do to fix this What I've done to fix this, is to not sort it in the sqlite, since the log entries are already added in forward order of time, so I'll just invert the row index when reading from the cursor.