Repository navigation
Conversation
| return readLabels(tile, false); | ||
| case DEDUPLICATE: | ||
| return readLabels(tile, true); | ||
| return readLabels(tile, true).deduplicate(); |
There was a problem hiding this comment.
@Sublimis Why calling extra method?
We already pass deduplicate true, so it should happen in readLabels like the pois.
There was a problem hiding this comment.
An additional method is required when you look at the algorithm. It doesn't really matter where exactly it gets called, as long as it's after all the reads and before returning the data to the caller. Now, using an extra parameter just for this is not productive. This parameter should go the way of the dodo once the algorithm is applied to POIs as well.
There was a problem hiding this comment.
@Sublimis Then we should make the new method to work also on the pois and remove the parameter?
Now the method appears half implemented as the deduplicate parameter works only on the pois
and we need to call an extra method to do the previous work on the ways too.
There was a problem hiding this comment.
Please let's do it in two steps. First to make this available to others for testing, and if all is good and accepted we'll implement pois as well. The functionality won't change anyway, and a new version is also not on the horizon :)
There was a problem hiding this comment.
@Sublimis Sure, users can test the PR in their builds.
But in order to merge it, we need the API to be complete.
This is public API that now a method does half work.
There was a problem hiding this comment.
@Sublimis I mean the public MapReadResult.add(MapReadResult other, boolean deduplicate)
that in the PR now deduplicates only the pois and needs and extra method for the ways.
Many users use the snapshots in their apps, so we cannot merge it in this state.
Unless the public add either works as before or we remove it and use the extra method?
There was a problem hiding this comment.
@Sublimis Why not using the old API and deduplicate (with the new algorithm) the ways inside the add
like before?
There was a problem hiding this comment.
@Sublimis Why not using the old API and deduplicate (with the new algorithm) the ways inside the
addlike before?
It feels more natural, less possibility of mistake, and it's usually better to be explicit about intentions in the code. Not a big deal though. The private MultiMapDataStore.read...() methods can keep their parameter (but why only boolean then, why not the dataPolicy?), however MapReadResult.add(MapReadResult, boolean) will definitely become obsolete.
There was a problem hiding this comment.
@Sublimis Why not using the old API and deduplicate (with the new algorithm) the ways inside the
addlike before?
Oh, you are talking about the MapReadResult.add()?? This method is called from the loop. While it could be done this way, it wouldn't be optimal, i.e. the resulting algorithm would be slower. It's much better to call the sort() once on a large collection, that many times on smaller collections increasing in size. Mathematics.
| if (this.hashWays.add(way.hashCode())) { | ||
| this.ways.add(way); | ||
| } | ||
| } |
There was a problem hiding this comment.
@Sublimis New deduplicate should happen here like the pois.
There was a problem hiding this comment.
Most definitely not. New deduplicate happens after all the reads, not during.
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| return this == o; |
There was a problem hiding this comment.
@Sublimis The previous equals made many checks.
There was a problem hiding this comment.
Yes, and this has been delegated to the compareTo() now. Please recall the flowchart: #1608 (comment)
| } else if (!(obj instanceof Way)) { | ||
| return false; | ||
| public int hashCode() { | ||
| return System.identityHashCode(this); |
|
I merged the pull request in branch issue_1629 for testing. |
Germany_oam.osm.mapfiles (just renamed, so exactly 3x duplication).MapWorkerPool.DEBUG_TIMING = true, starting with München area on scale = 20km.DEDUPLICATE(improved) took 2.3 seconds on average (±0.1).RETURN_ALLtook 3.1 seconds on average (±0.1).The performance of the legacy DEDUPLICATE method was tested later and found to be comparable to RETURN_ALL, thus significantly slower (unsurprisingly).
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).