Repository navigation
Ways and POIs deduplication performance and correctness improvement - #1635
Conversation
Ways and POIs deduplication performance improvement
| } | ||
|
|
||
| private MapReadResult readLabels(Tile tile, boolean deduplicate) { | ||
| private MapReadResult readLabelsPriv(Tile tile) { |
There was a problem hiding this comment.
@Sublimis Let's use a more understandable name in these methods.
Better a different name like processLabels, searchLabels, doReadLabels, etc.
|
@Sublimis Thanks, it looks good. 👍 I merged it in branch issue_1635 if anyone wants to test it. |
|
@Sublimis We can merge this, but the method names must be improved (see #1635 (comment)). |
|
@devemux86 Do you mind if we change |
|
@Sublimis No problem, although it introduces the problem that then we cannot easily rename / remove them without breaking user apps. |
|
@Sublimis Thanks for the changes. Is it ready? Should we also change the |
|
Question, since this hasn't been merged yet: Does the order of the elements in the |
Maybe, but since it's just a small world map with no expected duplicates, it's not that important. But it can be done for consistency, of course. |
It's not a big deal because these hashCode()/equals() are not currently used, but just in case they are needed in the future. |
@Sublimis Let's change also this, as we currently recommend the deduplicate as default? |
@Sublimis Was it like this before? |
Yes, but in the previous implementation this was done in a "passive" way so to speak, i.e. it was just a byproduct of the condition "should we add this element to the list or not", there was no explicit intent that we could now refer to. The current implementation intentionally preserves the order, but this is done only for safety reasons, not because we are 100% sure that the order should be preserved... Not sure, but the order in |
@Sublimis The rendering depends on the render theme. So it should not matter? Although better to test all of these to be sure? 🙂 |
|
Okay, let's try it now. The performance probably won't be much better, maybe a few percent at most, it's more about making hashCode() and equals() future-proof if possible. |
|
@Sublimis Do you mean it's ready or more changes are needed? |
|
Good news! The order of the elements doesn't seem to matter at all, and even the code is notably more efficient, by more than 10% in total execution time until the map is drawn. |
@Sublimis Let's include them here. |
|
You can leave this percolating here for another day or two AFAIC. The testers are asleep. 🆗 |
|
I updated branch issue_1635 if anyone wants to test it. |
|
@Sublimis Is it ready, should we merge it? |
Yup, ready 👍 |
|
@Sublimis Thanks, nice work! |
Deduplication performance and correctness improvement for ways and POIs.
Germany_oam.osm.mapfiles (just renamed, so exactly 3x duplication), without POIs.MapWorkerPool.DEBUG_TIMING = true, starting with München area on scale = 20km.Results:
DEDUPLICATE(improved) took 2.3 seconds on average (±0.1) to draw the map.RETURN_ALLtook 3.1 seconds on average (±0.1) to draw the map.The performance of the legacy DEDUPLICATE method was tested later and found to be comparable to RETURN_ALL, thus significantly slower (unsurprisingly).
An additional advantage of the new deduplication approach is correctness: This algorithm does not suffer from hash collisions, unlike the previous one. This becomes increasingly important as maps get bigger.
Android wasn't tested, but the relative results could be even better there, given that mobile devices have weaker GPUs. Not sure, though, maybe someone could do some testing on Android.
This makes the
DEDUPLICATEmethod a good candidate for the recommended and default behavior, possibly mitigating the need for map bounding polygons (#1608).