Editor shell rebuilds on every pan and zoom frame #88

Open
opened 2026-10-13 02:27:37 +00:00 by ImBenji · 0 comments
Owner

From the engineering review on 2026-10-13. Timings are flutter test debug mode on macOS and measure CPU work only, so read the scaling and not the milliseconds. Nothing here measured GPU cost.

lib/pages/map/canvas/canvas.dart posts onViewportMetricsChanged after each frame where pan or scale moved, and lib/editor_shared/editor_core.dart:3649 answers with _setStateSafely on the whole editor state. Each pan frame schedules a second build of the shell, which rebuilds MapCanvas again. onViewportInteractionChanged does the same at gesture start and end.

Also worth a look while in here: snapCursorV2 runs in build per hover while drawing a line and scales superlinearly (1.7 ms at 100 segments, 162 ms at 5000, from test/review_probes/perf_scene_and_hit.dart).

Status: the rebuild is confirmed by reading and was not costed.

Fix sketch: push viewport metrics into a ValueNotifier that only the readout widget listens to, and spatially prefilter snap candidates by snap radius.

From the engineering review on 2026-10-13. Timings are `flutter test` debug mode on macOS and measure CPU work only, so read the scaling and not the milliseconds. Nothing here measured GPU cost. `lib/pages/map/canvas/canvas.dart` posts `onViewportMetricsChanged` after each frame where pan or scale moved, and `lib/editor_shared/editor_core.dart:3649` answers with `_setStateSafely` on the whole editor state. Each pan frame schedules a second build of the shell, which rebuilds `MapCanvas` again. `onViewportInteractionChanged` does the same at gesture start and end. Also worth a look while in here: `snapCursorV2` runs in build per hover while drawing a line and scales superlinearly (1.7 ms at 100 segments, 162 ms at 5000, from `test/review_probes/perf_scene_and_hit.dart`). **Status:** the rebuild is confirmed by reading and was not costed. **Fix sketch:** push viewport metrics into a `ValueNotifier` that only the readout widget listens to, and spatially prefilter snap candidates by snap radius.
ImBenji added the enhancementarea:performance labels 2026-10-13 02:27:37 +00:00
ImBenji added this to the Arcs & Angles project 2026-10-13 02:27:37 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: IMBENJI.NET/Metro-Map-Maker#88