CartoDB / mobile-sdk

CARTO Mobile SDK core project
https://carto.com/docs/carto-engine/mobile-sdk/
BSD 3-Clause "New" or "Revised" License
185 stars 67 forks source link

way to debug slow style rendering #351

Open farfromrefug opened 4 years ago

farfromrefug commented 4 years ago

I ported the osm style to Carto Mobile SDK. Globally it is working just fine. everything is rendering correctly. However that style is slow to render. I can clealry see a difference with other (simpler) styles. osm.zip

Now there is 2 parts to that issues:

mtehver commented 4 years ago

I will try to get a closer look at the style but this may take a while. Normally each active layer (a layer that has at least 1 feature) in a tile needs a separate drawcall. This includes actual layers and 'virtual' layers created using '::'.

Though the SDK warns when using 20 drawcalls or more, this should be quite ok, if the layers are lightweight and there is not too much geometry. Usually the issue is that tiles for dense city areas are really large when decompressed and can take several megabytes of memory. And mapview contains normally 4-9 tiles at once. Mobile devices, especially the cheaper ones, have limited memory bandwidth and there is a lot of data to push for each rendered frame.

farfromrefug commented 4 years ago

Ok well I only see the issue with that style so I guess it does not come from an issue with tiles size on memory. I am currently trying to simplify that style a lot to see if it fixes things.

lasyakoechlin commented 4 years ago

@mtehver Thanks for that explanation. So, if we had the same X features, would it be better to have multiple active layers (e.g., 10) with X/10 features each? Or just one active layer with all X features?

(asking here, since it seemed relevant to the topic of slow rendering)

mtehver commented 4 years ago

@lasyakoechlin It really depends on the number of features/layers. If there are less than 20 layers, then I think it makes no sense in merging layers.