Skip to content
This repository was archived by the owner on Sep 11, 2026. It is now read-only.

perf(navigation): cache parsed vector tiles to reduce CPU load - #80

Merged
teal-bauer merged 1 commit into
mainfrom
perf/cache-vector-tile-decoding
Mar 12, 2026
Merged

teal-bauer merged 1 commit into
mainfrom
perf/cache-vector-tile-decoding

Conversation

@teal-bauer

@teal-bauer teal-bauer commented Nov 3, 2025

Copy link
Copy Markdown
Member

Caches parsed vector tiles in the navigation cubit so the same tile is not re-decoded from MBTiles every 3 seconds during navigation. Tiles are keyed by zoom/x/y and the cache holds up to 50 entries, evicting the oldest when full.

Test plan

  • Street names and speed limits still resolve correctly during navigation
  • Cache eviction works correctly after 50 distinct tiles are loaded

Implements LRU cache for decoded vector tiles in navigation cubit:
- Caches up to 50 parsed tiles to avoid re-decoding
- Cache key based on zoom:tileX:tileY coordinates
- Simple FIFO eviction when cache is full

Reduces CPU overhead from VectorTile.fromBytes() calls every 3s
during navigation, particularly beneficial on ARM processors.

Expected impact: 15-25% CPU reduction during active navigation
@teal-bauer
teal-bauer force-pushed the perf/cache-vector-tile-decoding branch from 8b08ea1 to ab6adde Compare March 12, 2026 18:44
@teal-bauer
teal-bauer merged commit 64a2ec2 into main Mar 12, 2026
1 of 2 checks passed
@teal-bauer
teal-bauer deleted the perf/cache-vector-tile-decoding branch March 12, 2026 18:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant