maplibre-gl-js icon indicating copy to clipboard operation
maplibre-gl-js copied to clipboard

Zoom perfomance with symbol layer type

Open just-website opened this issue 1 year ago • 5 comments

I'm trying to draw 2000 points on a type symbol layer and get big performance dips at every zoom step. The"text-allow-overlap" parameter does not cause visible changes. Now I can see that the findMatches method takes a very long time to complete at each zoom step.

Are such performance dips to be expected with the symbol type layer? What can be done to fix it on large layers symbol type than 30k points (is it possible?)?

image

https://github.com/maplibre/maplibre-gl-js/blame/18dcac916ccc0b7e7f1160533e5db5c34c28fffe/src/symbol/cross_tile_symbol_index.ts#L102

just-website avatar Sep 15 '23 10:09 just-website

Can you link to an example that demonstrates the issue? Jsbin?

HarelM avatar Sep 15 '23 20:09 HarelM

https://codepen.io/Gleb-Shchukin/pen/QWzOLPN?editors=1010 In this example I generate 10000 random points near Madrid. Try changing the zoom at the country level.

Aactually the problem was solved recently in mapbox. But I see that it is not possible to copy their solution directly (and that's why I’m not even sure if it makes sense to add a link to the PR here). I reproduced their PR locally and got *10 performance for the findMatch method.

just-website avatar Sep 18 '23 22:09 just-website

Yes, wet can't copy their code, you shouldn't link to their PR...

HarelM avatar Sep 19 '23 09:09 HarelM

Do you have any ideas for fix this?

just-website avatar Sep 19 '23 09:09 just-website

There's a need to run performance analysis and better understand what's causing this. I have no idea how to fix this. If this is something that you need solved, I think your best approach would be to try and solve this yourself and submit a PR. Make sure you don't look at the solution in mapbox so that you don't infringe their copyright.

HarelM avatar Sep 19 '23 14:09 HarelM