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

perf(map): cache trigonometric calculations in map animator - #81

Open
teal-bauer wants to merge 1 commit into
mainfrom
perf/cache-coordinate-transforms
Open

teal-bauer wants to merge 1 commit into
mainfrom
perf/cache-coordinate-transforms

Conversation

@teal-bauer

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

Copy link
Copy Markdown
Member

Caches sin/cos values in the map animator so they are not recalculated on every animation frame when the rotation has not changed. The cached values are reused if the rotation differs by less than 0.1 degrees, and cleared on disposal.

Test plan

  • Map rotation animates correctly during navigation
  • Vehicle position stays correctly offset from center while rotating

Caches sin/cos values for map rotation to reduce CPU overhead:
- Stores calculated sin/cos for current rotation angle
- Reuses cached values when rotation changes < 0.1 degrees
- Clears cache on disposal

Reduces trig operations during map animations, particularly
beneficial on ARM processors with slower FPU.

Expected impact: ~5% reduction in map animation CPU usage
@teal-bauer
teal-bauer force-pushed the perf/cache-coordinate-transforms branch from ced3b66 to 7068568 Compare March 12, 2026 18:44
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