Skip redundant linear visibility scans#179
Conversation
Merging this PR will improve performance by 13.04%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | test_animation_plain_payload_100k |
3.3 ms | 3 ms | +13.04% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing agent/skip-redundant-visibility-scans (a6523cd) with main (b0f8780)
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 avoids redundant visibility scans for finite linear payloads. The main changes are:
Confidence Score: 5/5This looks safe to merge. No blocking issues found in the changed code. Log axes still apply positive-domain filtering. Direct rows and area baselines retain non-finite filtering where required. A missing area selection remains equivalent to selecting every transition key.
What T-Rex did
Important Files Changed
Reviews (1): Last reviewed commit: "Skip redundant linear visibility scans" | Re-trigger Greptile |
Closes #169.
What changed
Root cause
_finite_selalready used zone-mapnull_countto avoid scanning all-finite direct x/y columns, but_emit_lineand_emit_scatterimmediately called_log_visible_maskanyway. That rebuiltisfinite(x) & isfinite(y)and reduced it withnp.alleven on ordinary linear axes. Area always built the mask and a fullflatnonzeroselection; its safe fast path also has to account for baseline nulls.Impact
A forced-direct, all-finite 2,000,000-point scatter payload build improved from 2.141 ms median to 1.569 ms median across 9 warmed runs on this checkout (about 27% faster). Large lines are already screen-bounded by M4; the main gain is large forced-direct scatter and the common no-filter work avoided on every direct xy build.
Verification
ruff check .— passed.ruff format --check .— 341 files already formatted.pre-commit run --all-files— all hooks passed (Ruff check, Ruff format, docs codespell).ty check python/xy/_payload.py— passed.git diff --check— passed.Safety notes
The fast path is deliberately narrow:
_finite_sel;