Skip to content

Chart: keep a coarse layer in memory so a fast pan never shows an empty pane #75

Closed as not planned

Description

@mrcsin

Why

Scroll fast and the pane goes blank, then fills a moment later.

Why it goes blank

Each pen owns exactly one column buffer, and a history load replaces it whole: TrendPenState.LoadHistory builds a list and hands it over in one Line.ReplaceColumns(columns) (Chart/TrendPenState.cs:38-49, Chart/EnvelopeLine.cs:109-115). Rendering culls to the viewport (Chart/EnvelopePath.cs:13-27); pan past the buffer and no column is visible, so Render returns having drawn nothing (Chart/EnvelopeLine.cs:86-90). There is no second buffer and no fallback layer anywhere.

The wait is the debounce plus the read: a 150 ms trailing throttle merged with a 400 ms cap (Chart/TrendChartViewModel.cs:23-24, Chart/ChartHistoryRequestDebouncer.cs:46-65), and the read itself measured at about 0.5 s near the raw ceiling (docs/plans/backlog.md:28-35). Prefetch covers one window width on each side (Chart/HistoryPrefetch.cs:12), so a slow drag never notices and a fast one always does.

Wanted

The fix is already written down in docs/plans/backlog.md:28-35 and this issue adopts it:

  • Keep the Minute layer and coarser in memory for the whole archive extent, read once at startup, one read per layer.
  • Draw the exposed strip from the coarse buffer immediately, then swap the Raw columns in when they land.
  • Widen the Raw margin to several windows, now that the frame no longer pays for buffer width (013f491).

What it costs

A coarse layer is 15 s per point (docs/architecture/data-integration.md:160-165). One year is about two million points per pen; fifty pens make that a hundred million, and at 32 bytes per column it does not fit in memory. So the startup read is bounded by something: a coarser layer for a long extent, or a column budget over the extent rather than a whole layer. #76 produces the numbers this decision needs; the plan should not guess them.

Acceptance

A headless test that pans faster than the debounce and asserts the plottable draws a non-empty path on every frame. Today no test would go red if the pane went blank forever.

Activity

  1. self-assigned this
    on Sep 10, 2026
  2. added
    enhancement
    on Sep 10, 2026
  3. mrcsin commented on Nov 12, 2026

    @mrcsin
    MemberAuthor

    Not planned. A cache of the coarse layers cannot serve the chart's reads: the date_bin grid is anchored at each request's own @from, so a cached layer only matches a request on an identical grid, and coarse rows arrive up to 47 minutes after their period closes, so a cached tail goes stale (docs/plans/backlog.md, "The strip a drag exposes still lags behind the gesture").

    The remaining part, a strip that stays empty while a fast drag outruns its read, stays in that backlog entry. The day calendar and page steps from #172 cut most of the long-distance panning that exposed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions