perf(map): optimize adjacency-aware room color calculation with LUT - #972
Open
allenporter wants to merge 1 commit into
Open
allenporter wants to merge 1 commit into
allenporter wants to merge 1 commit into
Conversation
This was referenced Sep 28, 2026
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Benchmark statistics, CLI validation, and type-checking dependency issues remain unresolved.
Review effort: Lite
Findings: 3
Open (3)
What changed in this PR
Optimizes Q10 map rendering and room-color adjacency processing while adding benchmark tooling.
Changes:
- Adds LUT-based room lookup and adjacency fast paths.
- Uses PIL palette-mode rasterization.
- Adds benchmark coverage and profiling support.
| File | Summary |
|---|---|
tests/map/test_benchmarks.py |
Adds benchmark and profiling tooling. Final comments identify inaccurate median/P95 calculations, invalid non-positive iteration handling, and an undeclared pytest-codspeed type-checking dependency. |
roborock/map/room_colors.py |
Optimizes adjacency-aware room coloring with LUT conversion and neighbor short-circuiting. |
roborock/map/b01_q10_map_parser.py |
Uses palette-mode rendering for faster rasterization. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
allenporter
marked this pull request as draft
September 28, 2026 03:46
allenporter
force-pushed
the
perf-room-colors-lut
branch
3 times, most recently
from
October 4, 2026 22:40
c4ecf45 to
ad34dc7
Compare
allenporter
force-pushed
the
perf-room-colors-lut
branch
from
October 5, 2026 14:17
ad34dc7 to
6d21f5f
Compare
allenporter
force-pushed
the
perf-room-colors-lut
branch
from
October 5, 2026 14:48
6d21f5f to
3b71a6b
Compare
allenporter
marked this pull request as ready for review
October 5, 2026 14:56
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
Optimizes
adjacency_aware_room_colorsinroborock/map/room_colors.py:room_id_from_cellbyte conversions, avoiding hundreds of thousands of dynamic callback invocations per grid pass.neighbor_val != value) to immediately skip adjacent cells with identical pixel values (which belong to the same room).Performance Impact (Benchmarked on 200x200 grid)
adjacency_aware_room_colorsstandalone: 14.85 msadjacency_aware_room_colorsVerification
uv run pytest tests/map/).