-
Notifications
You must be signed in to change notification settings - Fork 240
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
Add support for updating and deleting MapData features #2112
base: main
Are you sure you want to change the base?
Conversation
That is exactly what I need. Currently I re-set the whole MapData whenever one geometry is added or removed. I can imagine this is not very performant but there doesn't seem to be another option to do this right now. |
This does save some processing compared to re-setting all of the features in the layer, but since any feature change needs to propagate down to GPU buffers, we still need to rebuild those buffers and upload them to the GPU again. It's not obvious that this feature would make enough difference in performance to justify the added complexity. Have you done any profiling to see where the bottlenecks are? |
Would love to see a comparison in terms of speed. What this saves in any case is the necessity to keep the data in Java as well (to reach the same functionality). So, apart from any considerations of speed, it'd be a more convenient interface. |
@matteblair Unfortunately I have no experience with profiling C++ native code on Android. Do you have some hints how can I profile it? |
Couldn't you just count the milliseconds it takes for
to complete and print it to console? B then is the time it it takes for rebuilding the buffers and upload them to the GPU. |
There's also work that happens asynchronously when map data is changed, that would have to be instrumented differently. But the measurement you described could be informative. |
Ok, I have profiled methods Both profiled methods also calls a C++ method |
Can you also say the absolute numbers? Note on |
I'm interested in absolute numbers too - if makes a difference if the change is a few microseconds vs a few milliseconds. The main operations in |
Ok, profiling scenario was this: add polyline by For first couple of polylines it was under 10 milliseconds for both both methods. And then it started to slow down. At the end it was around 150 miliseconds for I suggest that you can also profile it, so we will have better understanding of actual performance difference. Overall in average there was 15% difference. |
So, the big majority of the time is not spent in copying the data from Java to native but in generating the tiles (or uploading to buffer). So from a sheer performance point of view, this (alone) does not make much of a difference, but what it does it to have a more convenient interface. And, it opens up the path for more performance improvement (on geojson-vt-cpp). |
When we first introduced ClientDataSources, we had support for updating MapData features, but performance bottleneck on geojson-vt library was present then also. I vaguely remember having similar discussions during good old eraser-map (ClientDataSource was implemented to fulfill the needs for Erasermap app) development days at mapzen, which is when we decided to remove this feature. |
Add support for updating and deleting MapData features. I have only created updating and deleting polyline features as I am not sure if you would want to add this functionality. If you would want it, I can make it more general and clean it up, because now it is only a very ugly hack.