Ship heatmaps in texture-native byte formats#190
Conversation
Merging this PR will degrade performance by 28.63%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | test_first_payload_heatmap_core_2d |
1.6 ms | 2.2 ms | -28.63% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing agent/quantize-heatmap-wire (3de3171) with main (2a7d898)
Footnotes
-
1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports. ↩
Greptile SummaryThis PR moves heatmap payloads to texture-native byte formats. The main changes are:
Confidence Score: 4/5The uint8 alpha normalization path needs a fix before merging. Scalar encoding and its browser and static decoders are consistent. Packed and split buffer handling account for u8 widths and padding. A valid uint8 RGBA image with alpha values limited to 0 and 1 renders with incorrect opacity in python/xy/marks.py.
What T-Rex did
Important Files Changed
Reviews (1): Last reviewed commit: "Ship heatmaps in texture-native byte for..." | Re-trigger Greptile |
| if rgba.shape[-1] == 4: | ||
| finite_alpha = rgba[..., 3][np.isfinite(rgba[..., 3])] | ||
| if finite_alpha.size and finite_alpha.max() > 1.0: | ||
| rgba[..., 3] /= 255.0 |
There was a problem hiding this comment.
A uint8 RGBA image whose alpha channel contains only 0 and 1 skips byte normalization because its maximum is not greater than one. Alpha 1 is then packed as 255, so nearly transparent pixels render fully opaque instead of preserving their RGBA8 opacity.
| if rgba.shape[-1] == 4: | |
| finite_alpha = rgba[..., 3][np.isfinite(rgba[..., 3])] | |
| if finite_alpha.size and finite_alpha.max() > 1.0: | |
| rgba[..., 3] /= 255.0 | |
| if rgba.shape[-1] == 4: | |
| finite_alpha = rgba[..., 3][np.isfinite(rgba[..., 3])] | |
| alpha_is_byte = np.issubdtype(arr.dtype, np.integer) | |
| if finite_alpha.size and (alpha_is_byte or finite_alpha.max() > 1.0): | |
| rgba[..., 3] /= 255.0 |
Artifacts
Repro: native payload and standalone application fixture
- Contains supporting evidence from the run (text/x-python; charset=utf-8).
Repro: Playwright Chromium capture harness
- Contains supporting evidence from the run (text/javascript; charset=utf-8).
Repro: rendered screenshot pixel-readback harness
- Contains supporting evidence from the run (text/x-python; charset=utf-8).
Repro: native alpha decoding and browser pixel-readback output
- Keeps the command output available without making the summary code-heavy.
Repro: successful Chromium application rendering and capture output
- Keeps the command output available without making the summary code-heavy.
- Shows the rendered state that T-Rex checked.
▶ Screen recording from the T-Rex run
- Shows the flow or interaction that T-Rex exercised.
Summary
Truecolor normalization now owns its working buffer and preserves both conventional 0–1 and 0–255 alpha without mutating caller data.
Verification
test_client_source_is_the_installed_bundleassertion looks for unminified local symbol spellings in the minified production bundleruff check .: passedruff format --check .: 342 files already formattedtsc -p js/tsconfig.json --noEmit: passednode js/build.mjs --check: shipped bundles freshgit diff --check: passedLocal first-paint benchmark
Fixture construction excluded; three payload builds per row:
Closes #164