perf(trait): cache rendered base map on Q10 trace updates - #974
Draft
allenporter wants to merge 6 commits into
Draft
allenporter wants to merge 6 commits into
allenporter wants to merge 6 commits into
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Address calibration cache invalidation and erase-zone rebuilding, benchmark input/percentile handling, and related test coverage.
Review effort: Lite
Findings: 2
Open (2)
What changed in this PR
Improves Q10 map rendering performance by caching base-map data, layers, and calibration across trace updates.
Changes:
- Adds cached base-map rendering and overlay composition.
- Caches Q10 layer decomposition and optimizes room-color calculations.
- Adds map parsing, rendering, and profiling benchmarks.
| File | Summary |
|---|---|
tests/map/test_benchmarks.py |
Adds benchmark utilities; percentile calculation and non-positive iteration handling require correction. |
roborock/map/room_colors.py |
Optimizes room-color adjacency calculations. |
roborock/map/b01_q10_render.py |
Adds reusable base-map rendering and composition. |
roborock/map/b01_q10_map_parser.py |
Caches layers and defers PNG serialization. |
roborock/devices/traits/b01/q10/map.py |
Adds base-map and calibration caching; calibration lifecycle and coverage require changes. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+189
to
+193
| if self._base_map_data is None: | ||
| self._base_map_data = build_base_q10_map_data(self._map_packet, config=self._config) | ||
| trace = self._trace_packet if not self._map_dps.robot_at_dock else None | ||
| if self._trace_calibration is None and trace is not None: | ||
| self._trace_calibration = solve_q10_calibration(self._map_packet, trace) |
| parser.add_argument("--profile", action="store_true", help="Print cProfile hotspot breakdown for each benchmark") | ||
| args = parser.parse_args() | ||
|
|
||
| _run_benchmarks(iterations=args.iterations, warmup=args.warmup, profile=args.profile) |
allenporter
marked this pull request as draft
September 28, 2026 03:46
allenporter
force-pushed
the
perf-q10-base-map-caching
branch
3 times, most recently
from
October 4, 2026 22:40
e255fad to
d086d5d
Compare
allenporter
force-pushed
the
perf-q10-base-map-caching
branch
from
October 5, 2026 14:17
d086d5d to
05c3968
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
During an active cleaning run, the robot pushes
Q10TracePackettrajectory updates every 1–2 seconds. Previously, each trace packet push triggeredself._render(), which re-decomposed the entire 40,000-cell occupancy grid, re-rasterized the base room layers, and re-solved calibration from scratch.This change:
MapContentTrait(_base_map_data). When only a trace update arrives, the cached base grid is reused and only the path/robot overlays are re-composited._base_map_dataand_trace_calibrationcleanly upon receiving full map updates or DPS changes.Q10MapPacket.layerstocached_propertyto avoid redundant grid decompositions.Note: Stacked on top of #973, #972, #971, and #970.
Performance Impact
Verification
uv run pytest tests/map/ tests/devices/).