Skip to content

Improve global predictions performance#253

Merged
ahocevar merged 1 commit into
mainfrom
predictions-layer-performance
Apr 20, 2026
Merged

Improve global predictions performance#253
ahocevar merged 1 commit into
mainfrom
predictions-layer-performance

Conversation

@ahocevar
Copy link
Copy Markdown
Collaborator

This pull request improves the rendering performance of the global predictions layer:

  • Redefine view zoom levels so zoom 0 is the Web Mercator world on a 512x512 pixel tile. This is what Mapbox/MapLibre folks are used to.
  • Hint the fields layer to have no overlaps (speeds up rendering by making use of larger batches)
  • Improve the style by reusing style objects and pre-calculating colors
  • Debounce the confidence slider (like in the MapLibre proof-of-concept)
  • Do not fill tiny polygons where the stroke would not be visible anyway, because it's less than 1 pixel in size
  • Use cheaper butt, miter and miter limit settings for strokes

These changes speed up rendering by approximately a factor of 10 on my machine.

If people still feel there is too much lag when panning or changing the confidence, I can make another change that decouples rendering from the main thread, so the UI is not blocked at all any more.

@m-mohr
Copy link
Copy Markdown
Collaborator

m-mohr commented Apr 20, 2026

This changes the couple of seconds unresponsiveness (depending on area) to pretty much no unresponsiveness for me (depending on area).

"Calebs example in the US" is responsive throughout, "my north nile example" has a bit of stutter while panning but not much.

When we can move some of the COG + PMTiles rendering into workers, this could solve it altogether.

@ahocevar ahocevar merged commit d76465c into main Apr 20, 2026
1 check passed
@m-mohr m-mohr deleted the predictions-layer-performance branch April 20, 2026 14:58
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.

2 participants