-
-
Notifications
You must be signed in to change notification settings - Fork 932
Use only bounds for geojson diff tile reload #6800
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
base: main
Are you sure you want to change the base?
Conversation
|
@lucaswoj @wayofthefuture let me know what you think about the direction of this PR before I invest more time in fixing the tests and adding new tests. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6800 +/- ##
==========================================
- Coverage 92.42% 92.41% -0.01%
==========================================
Files 288 288
Lines 23807 23803 -4
Branches 5056 5056
==========================================
- Hits 22003 21998 -5
- Misses 1804 1805 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…plibre-gl-js into 6795-use-only-bounds
Add a newline at the end of the HTML file.
|
I like the way this is headed. However, let's say a feature was moved from 1 tile to another tile. How do you know to invalidate the previous tile without the feature id? The new bounds would not affect the previous tile. |
|
If a feature was moved from one tile to the other - I have the previous geometry just before I apply the update, and the new geometry. |
|
I've gone and updated the relevant tests. I've removed some tests that are "duplicated" in the sense that they are being tested in lat lng bounds and there's no need to retest them in geojson source. |
|
Please hold off on merging these changes until I have time to review later today. I think this introduces some new bugs. |
|
Sure, take your time. I wouldn't merge this before you review it. |
| if (tile.state === 'unloaded') { | ||
| return false; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this codepath will cause performance regressions in some cases. Although having two codepaths is ugly, invalidating tiles by id is much faster and more accurate than doing so by bounds.
|
Can we measure how much performance degradation this is causing? |
There's not a single number that captures the whole picture. We can say that #6562 would no longer apply to sources loaded from a URL, so updating 1 point out of 100k points would become ~100% slower after this PR merges. #6562 would also no longer apply in some cases involving more complex geometries, like an L-shaped line that crosses three out of 4 tiles in the viewport. We could create another benchmark that would become ~100% slower after this PR merges, for a non-URL-backed source. |
|
Fair enough, can you take a look at the lat lang bounds failing test? I'm not sure I understand why it's failing. |
|
It's worth mentioning that for tiles with a lot of features and small updates to the geojson, this route has better performance. |
Just created #6802 to investigate |
|
@mwilsnd does the fix related to geojson undefined properties has to do with the feature index etc? |
|
Take a look: #6803 - this just changes how the layers are constructed in the feature index for geojson sources, I'm not sure if this is fully related. |
|
The features from the geojson are sent back for every tile, so it might be somewhat related, I'm not sure, I need to wrap my head around it... |
| * Refresh all tiles that PREVIOUSLY DID contain these feature ids. | ||
| */ | ||
| prevIds: Set<GeoJSON.Feature['id']>; | ||
| affectedBounds: LngLatBounds[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since affectedBounds is the only property, would it be better to remove shouldReloadTileOptions and simply pass affectedBounds in the data event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think keeping it this way allows adding properties in the future if needed, so I'm fine with keeping it that way.
I had the same thought myself, but decided to keep it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if the change I made here makes sense now: 755ec5f
| for (const feature of diff.add) { | ||
| const id = getFeatureId(feature, promoteId); | ||
| if (id != null) { | ||
| affectedGeometries.push(feature.geometry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently updateable allows the addition of duplicate (replacing) feature ids, so you might want to consider checking/adding existing affected feature geometry here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify a bit what you mean here?
I can move the push before the "if", if that's what you mean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After giving this a look I can say that I definitely prefer this solution. Considering it's a geojson source, and geojson supports string ids, the fact that this also supports string ids just makes sense. It also saves us (and many) a breaking refactor to eliminate the warning. (correct me if I'm wrong).
Also, @HarelM's implementation is similar to my implementation used in the differential GeoJSON-VT PR that is pending. In this PR, updates are applied to the source and affected features are returned as well. Not sure if that would benefit in the future, but I like the idea of both sides using similar methods.
|
Thanks for the review! There are some performance changes (in some flows they are improved while in others they degrade). I'll work on the review comments nevertheless. |
Launch Checklist
This changes the logic of tile refreshing for geojson
The idea behind this fix:
CHANGELOG.mdunder the## mainsection.