Skip to content

Redraw tiles once per burst of tiled-marker changes - #15

Merged
wf9a5m75 merged 1 commit into
developfrom
perf/tiled-marker-update
Nov 6, 2026
Merged

wf9a5m75 merged 1 commit into
developfrom
perf/tiled-marker-update

Conversation

@wf9a5m75

@wf9a5m75 wf9a5m75 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Same change as MapConductor/android-for-maplibre#18.

Relabelling street trees changes a few dozen tiled markers at once, and each update() replaced the raster source, so the map fetched every visible tile again per marker (MapLibre on Pixel 5a: 6.1 s → 0.25 s with this change).

  • Changes arriving within a frame share one tile refresh (16 ms, under the controller semaphore). A pending refresh is cancelled in destroy() so it cannot register the tile route again.
  • The tiling check reads the entity count without copying all entities.
  • The icon is baked only when the marker is drawn natively.
  • onPostProcess runs only when a native marker became tiled (it copies every entity to redraw the native ones).

Checked on Pixel 5a with the street-tree sample: labels redraw after each pan, no crashes.

Same change as android-for-maplibre: relabelling street trees changes a few
dozen tiled markers at once, and each update() replaced the raster source,
so the map fetched every visible tile again per marker (on MapLibre, Pixel 5a:
45 replacements, 494 tile renders, last tile 6.1 s after the change).

- Changes arriving within a frame share one tile refresh; a pending refresh is
  cancelled on destroy() so it cannot register the tile route again.
- The tiling check reads the entity count without copying all entities.
- The icon is baked only when the marker is drawn natively.
- onPostProcess runs only when a native marker became tiled (it copies every
  entity to redraw the native ones).
@wf9a5m75
wf9a5m75 merged commit 715e1f0 into develop Nov 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant