Repository navigation
Prevent multiple symbols at the same zoom from sharing a crossTileID - #5994
Conversation
|
I put together a commit that does periodic pruning instead of doing the pruning during |
| const zoomIndexes = this.indexes[z]; | ||
| for (const tileKey in zoomIndexes) { | ||
| if (!currentIDs[zoomIndexes[tileKey].bucketInstanceId]) { | ||
| for (const key of Object.keys(zoomIndexes[tileKey].indexedSymbolInstances)) { |
There was a problem hiding this comment.
is there an advantage to using for (const key of Object.keys(z)) instead of for (const key in z)) in this case?
There was a problem hiding this comment.
I don't think so, it's just left over from an earlier implementation I tried iterating over Object.entries. I'll update it to the simpler form.
Fixes issue #5993, which would allow multiple symbols in a tile to share the same crossTileID as one of their duplicate parent-tile symbols. Once the symbols shared a crossTileID, they would permanently remain "duplicates" of each other, even after increasing zoom level allowed the CrossTileSymbolIndex to distinguish between them.
Fixes issue #5993, which would allow multiple symbols in a tile to share the same crossTileID as one of their duplicate parent-tile symbols. Once the symbols shared a crossTileID, they would permanently remain "duplicates" of each other, even after increasing zoom level allowed the CrossTileSymbolIndex to distinguish between them.
This change introduces some extra work on removing a bucket (since we have to iterate through all symbol instances removing their crossTileIDs from the index), but it doesn't really show up in benchmarks. However, running the Chrome javascript profiler while doing pan and zoom operations, I'm seeing
removeStaleBucketstaking .5-1.5% of CPU time, which seems tolerable but still pretty concerning. Since there's no time urgency on the pruning, maybe we can set up a separate pruning function that we just run once every N minutes/iterations/frames?On top of the unit test, I tested by manually exercising the "chinese.html" debug page with the keys all set to the same value. I watched to see how crossTileIDs got assigned and watched that
usedCrossTileIDswasn't growing without bound.@friedbunny once we get this in we'll port it over to native to fix the original annotation view bug.
/cc @ansis