Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

always return complete ways on getMapDataWithGeometry #4988

Merged
merged 6 commits into from
May 5, 2023

Conversation

Helium314
Copy link
Collaborator

fixes #4980

MapDataCache can now fetch nodes if for some reason it's neither in SpatialCache nor in nodeCache. This can be because of trim (simply clears nodeCache), but also for other reasons, e.g. SpatialCache removing tiles unexpectedly (see #4985).

Performance:

  • getMatDataWithGeometry is slower
    • for large bboxes (usually for overlays) 20-30% of total time is spend on finding / adding nodes needed for complete ways
    • for small bboxes (highlighted elements), this is more, around 30-90%. This may seem much, but even on a S4 mini and a debug APK data is returned within 5-20 ms
  • update is typically around 10% slower due to properly handling nodeCache (25% observed, this was by far the worst case)
  • fetching nodes happens only after trim and after encountering the tilesRect.asBoundingBox(zoom).enclosingTilesRect(zoom) issue
    • fetched nodes are cached in nodeCache, so even after trim this fetch does not happen often
    • for small bboxes, fetching nodes (if necessary) takes typically 50% of the total time of getMatDataWithGeometry
    • for large bboxes (overlays), it's more like 15-20% (up to 60% observed)

IMO the performance impact is acceptable, and likely any improvements will not be worth the effort.

Some work is still to be done: No new tests are added, and some old tests fail now.

@Helium314
Copy link
Collaborator Author

MapDataCache tests work now, and a test is added whether a node outside the bbox is returned if it's part of a way that also has nodes inside the bbox.

ElementsDaoTest.getAllElementsByBbox still fails, and here some more tests should be added (maybe I'll try tomorrow, but feel free to work on this).

Copy link
Member

@westnordost westnordost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you say, needs a few tests for the Dao. Additionally, I found some things that could be done to make it faster (again).

@Helium314
Copy link
Collaborator Author

I think with the latest test this is complete now

@westnordost
Copy link
Member

Awesome, thank you!

FYI I released the beta already yesterday to stay true to the announcement in the changelog from v52.1 that the beta will be released on the 3rd but included a note that it is known that the feature dependent on this are not fully functional yet.

@westnordost westnordost merged commit df6328a into streetcomplete:master May 5, 2023
@westnordost westnordost deleted the return_complete_ways branch May 5, 2023 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MapDataController::getMapDataWithGeometry returns incomplete Ways
2 participants