-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Efficiently apply style changes #2445
Comments
cc @scothis |
Note that style diffing is not currently built in to mapbox-gl-js: it's an external function which produces a set of commands to run in a batch style change. |
Batching style mutations is what gave us the greatest perf boost, followed by the style diff. Diff'ing without batching is most likely a perf hit rather than a gain (for a non-trivial delta). I'd like to keep the diff format compatible between JS and native if at all possible, although the JS diff is biased towards the mapbox-gl-js API. |
Me too, which means the first part of this change is porting all the JS style mutation APIs. It's something we've been meaning to do for quite some time, but a substantial change in and of itself. |
It's also worth mentioning that mapbox-gl-js does not support every diff operation. In studio when we apply the diff, we fall back to a full setStyle if a particular operation is unsupported. The most important operations to support are:
From there add support for any operation you see that frequently causes a setStyle fallback. The semantics around add/removeLayer are particularly important to get right as the diff is optimized to avoid unnecessary work. For example, if you move a layer and change a property the diff will be two operations: removeLayer and addLayer. |
Depends on #837, more or less. |
⇢ #7893 |
In JS, we have a way to compute the difference between two styles, and only selectively reparse tiles. This is very useful in Native as well, as it'd allow us to rapidly switch styles without seeing a flash of an empty map. Also see mapbox/mapbox-gl-js#1341.
The text was updated successfully, but these errors were encountered: