Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Efficiently apply style changes #2445

Closed

Description

@kkaefer

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.

  • Figure out a way to reparse individual layers of a tile and how buffer uploads are handled
  • Compute differences between style objects, e.g. by creating a hash of all properties of a layer

Activity

  1. mourner commented on Sep 29, 2015

    @mourner
    Member
  2. jfirebaugh commented on Sep 29, 2015

    @jfirebaugh
    Contributor

    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.

  3. added
    performance
    on Sep 29, 2015
  4. scothis commented on Sep 30, 2015

    @scothis

    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.

  5. jfirebaugh commented on Sep 30, 2015

    @jfirebaugh
    Contributor

    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.

  6. scothis commented on Sep 30, 2015

    @scothis

    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:

    • addLayer
    • removeLayer
    • setLayoutProperty
    • setPaintProperty

    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.

  7. jfirebaugh commented on Oct 2, 2015

    @jfirebaugh
    Contributor

    Depends on #837, more or less.

  8. jfirebaugh commented on Feb 11, 2017

    @jfirebaugh
    Contributor

    ⇢ #7893

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    performance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions