Repository navigation
perf(map): eliminate redundant PNG serialization in Q10 rendering pipeline - #973
Open
allenporter wants to merge 1 commit into
Open
allenporter wants to merge 1 commit into
allenporter wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Benchmark coverage and percentile reporting need correction before approval.
Review effort: Lite
Findings: 2
Open (2)
What changed in this PR
Optimizes Q10 map rendering by deferring PNG serialization until composition completes, while preserving existing parsing APIs.
Changes:
- Adds PNG-free
MapDatarendering. - Serializes composed images once.
- Optimizes room-color lookup.
- Adds map benchmarks and profiling support.
| File | Summary |
|---|---|
tests/map/test_benchmarks.py |
Adds map benchmarks; composite coverage does not exercise overlays, and the reported P95 calculation is incorrect. |
roborock/map/room_colors.py |
Adds lookup-table-based room color resolution. |
roborock/map/b01_q10_render.py |
Defers PNG serialization in the rendering pipeline. |
roborock/map/b01_q10_map_parser.py |
Separates image construction from PNG encoding while preserving compatibility. |
💡 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-q10-render-pipeline
branch
2 times, most recently
from
September 28, 2026 05:04
65d5c60 to
4b9b409
Compare
allenporter
force-pushed
the
perf-q10-render-pipeline
branch
2 times, most recently
from
October 5, 2026 14:17
fc6c0fd to
7c59a0b
Compare
allenporter
force-pushed
the
perf-q10-render-pipeline
branch
from
October 12, 2026 02:15
7c59a0b to
4a38ee6
Compare
allenporter
marked this pull request as ready for review
October 13, 2026 12:59
allenporter
force-pushed
the
perf-q10-render-pipeline
branch
from
October 13, 2026 13:06
4a38ee6 to
3607ff1
Compare
allenporter
marked this pull request as draft
October 13, 2026 13:17
allenporter
force-pushed
the
perf-q10-render-pipeline
branch
from
October 13, 2026 13:20
3607ff1 to
a49913c
Compare
allenporter
force-pushed
the
perf-q10-render-pipeline
branch
from
October 13, 2026 13:24
a49913c to
db2820c
Compare
allenporter
marked this pull request as ready for review
October 13, 2026 13:27
allenporter
commented
Oct 13, 2026
allenporter
left a comment
Contributor
Author
There was a problem hiding this comment.
A separate future change will remove some of the methods that still exist just for testing.
Lash-L
approved these changes
Oct 15, 2026
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
In
render_q10_map, the base packet was previously rendered to PNG bytes viaparsed_from_packet. Then, whenever the map contained drawables (charger, trace path, virtual walls, or no-go zones—which is almost always true),_draw_map_contentre-serialized the image to PNG bytes a second time, discarding the first PNG bytes.This change:
B01Q10MapParser.map_data_from_packet(packet)returningMapDatawith the rendered baseImagewithout performing premature PNG encoding.render_q10_map, defers PNG serialization to the end of the pipeline so that images are encoded exactly once.parsed_from_packetfully backward-compatible for existing callers.test_benchmark_q10_map_render_with_tracebenchmark exercising the composite path.Performance Impact
Eliminates duplicate PNG compression (
Image.save(..., format="PNG")) and intermediate byte buffer allocations whenever overlays or traces are drawn:test_benchmark_q10_map_render_with_trace: 0.804 msmain)render_q10_mapwith TraceNote: The existing
test_benchmark_q10_map_full_scale_rendertests only base grid parsing viaparse_packet, so their numbers are unchanged. The win is captured in composite rendering with overlays (render_q10_map).Verification
uv run pytest tests/map/).test_benchmark_q10_map_render_with_traceimage integrity check.