Update of diary after adding a waypoint takes very long time

Issue #160 new
Rainer Unseld created an issue

For a project with 30 tracks and 50 waypoints, I do the following

  • open the project in the workspace
  • edit the project -> diary window is opened, diary is built, takes some seconds
  • in the map view: add a waypoint on one of the tracks of the project

I then get:

  • popup windows "build diary" appearing one after another, each of them staying for about 10 seconds
  • a popup window "correlate tracks and waypoints" with a progress bar advancing very slowly. The progress is roughly one percent per minute.

This is independent from the diary sort mode.

IMHO updating the diary after adding a waypoint should not take much more time creating the diary when entering edit mode.

Comments (8)

  1. kiozen

    This is not a bug. It's simply an equation of your system's computation power, the number of waypoints in a project, the number of tracks and the number of track points per track.

    If you change something like introducing a new waypoint, moving track or waypoints, all relations have to be evaluated again from scratch. This is necessary because the change could remove the one relation and replace it by another. Thus it's not sufficient to evaluate just the points changed.

    I already spent quite some time to remove unnecessary triggers of the re-computation. If you think I missed one give me a notice.

    I considered several approaches to optimize the process by estimating the part of the re-computation to skip. I did not find a feasible and reliable solution to the problem. The system would need to analyze the change on a 2D plane. For that the internal data structure must be completely different. But the structure is as it is because of other constrains. Probably that is why most GIS applications do not offer that feature.

    An alternative would be to make the user to attach waypoints to a track manually. Afaik this is how CompeLand does it. But I hate doing it manually. I prefer the automatism to get a ready made roadbook on my TwoNav device (the reason why this feature exists in the first place).

    My advice:

    • Reduce the number of track points.
    • While you work on the project use the database to load only necessary tracks and waypoints
    • Is it really necessary to have such a big heap of tracks and waypoints in a single project? And thus one single document? Maybe several projects will do, too. After all you can create a large summary project from all projects in the database. You work on the small ones. When done you update the big one.
  2. Rainer Unseld reporter

    When I add a waypoint to the project while the diary tab is closed and then open then diary, the diary is created within few seconds and the new waypoint is appearing at the correct position in the diary. So my workaround is to open the diary only after all modifications are done and saved.

    I still wonder why it is the build diary popup that is "looping" and the diary is written to the display at each loop. The impression is that most of the time is spent rendering the diary.

  3. kiozen

    Yes kind of. The user expects the diary to be updated as soon as any element changes. (icon, text, etc...) So every time a track changes - got a waypoint attached - the diary updates. This is a side effect of that ugly progress dialog. To update the progress and to react on the cancel button, the application’s event loop has to be triggered. If it is triggered all signals that are emitted on a change are processed, too. Imho that is a real design flaw of QT. The progress dialog would need it's own loop.

    Anyway, that is causing the updates in parallel to the re-calculation. And as this is not in multiple threads it's just running on a single core. Maybe I can find a nasty way to block this. Would be another dirty hack because of this progress dialog. There are already a couple.

    Am 17.08.2016 um 18:42 schrieb Rainer Unseld:

  4. Rainer Unseld reporter

    Finally the time needed to correlate the tracks and waypoints of my project is not as long as suspected. Processing ends after roughly 3 minutes when the progress bar of the correlate tracks and waypoints window is at 4%.

    If there is no proper way to have the diary updated only once when the recalculation is finished, I think there is no need to do change whatsoever.

  5. Rainer Unseld reporter

    Move a waypoint -> diary is rebuild once only -> OK

    Modify track points -> diary is rebuild three times

  6. Log in to comment