Skip finite/log visibility scans when zone maps already prove all-finite on linear axes

Open Beginner friendly
#169 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Quiet
Tech stack
numpy, python

Research direction

Start in python/xy/_payload.py at _finite_sel, _log_visible_mask, and the _emit_line and _emit_scatter call sites. Review the existing zone-map null_count and linear/log-axis behavior, then add focused tests for the fast path and log-axis cases. Done means finite scans are skipped only when null_count is zero and both axes are linear, with existing behavior preserved.

Written by the indexing model from the issue text.

Description

needs investigate performance

From a full data-transport audit at b0f8780.

Today: _finite_sel correctly consults zone-map null_count first (python/xy/_payload.py:352-362), but _log_visible_mask (_payload.py:364-380) — called unconditionally from _emit_line (:422) and _emit_scatter (:466-470) — then recomputes isfinite(xv) & isfinite(yv) plus np.all(mask): ~3-4 full O(N) passes per trace per build that are provably all-true when null_count == 0 and neither axis is log.

Proposed fix: guard with if null_count or x_log or y_log: before building the mask; return the no-mask fast path otherwise. Pure CPU win on every direct build of every line/scatter trace; one-line-ish change plus tests.

Dominant language
Python
Stars
1.8k
Forks
76
Avg merge
1h 7m
Merged PRs (30d)
8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from reflex-dev/xy

All issues in reflex-dev/xy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.