Skip to content

Feat/line lttb fpcs - #27

Merged
jvdd merged 2 commits into
mainfrom
feat/line-lttb-fpcs
Sep 8, 2026
Merged

jvdd merged 2 commits into
mainfrom
feat/line-lttb-fpcs

Conversation

@jvdd

@jvdd jvdd commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

jvdd added 2 commits September 4, 2026 19:56
Add downsample="lttb". It is MinMaxLTTB: the ungrouped minmax pass
runs with a fixed 4x budget, then a pure-Python Largest-Triangle-
Three-Buckets pass thins the prefetch to exactly n_points, fewer
when x gaps leave buckets empty. The kernel serves resident frames
and the streaming plan serves scans, so both source kinds give the
same points. Grouped lttb raises until grouped lines get an x-width
grid.

Rework fpcs on the same two-stage shape. Stage 1 is a new Rust
kernel, minmax_pairs_line, that keeps one (x_min, y_min, x_max,
y_max) row per bucket, or a pair-emitting streaming plan on scans.
Stage 2 is the compensation walk ported to Python. The walk reads
only the pair endpoints, so the port matches the old kernel index
for index on row-count buckets. Ungrouped fpcs now buckets by x
width like minmax and streams on scans instead of materializing the
column. Grouped fpcs keeps row-count buckets. The Rust fpcs kernels
and the flexviz.fpcs namespace method are deleted.

Both stages drop null and NaN rows before they run, so an all-NaN
bucket no longer leaks a point. lttb takes a temporal y through its
physical representation.

Move the line contract onto the trace and make the engine its one
authority. LinePlot owns buckets_by_x_width and check_schema, which
rejects a missing y and a non-arithmetic y for lttb. The engine
checks every line trace against the current source before domain
resolution, once per x column, so two lines sharing x pay one
sortedness collect. Figure.add_line only records assume_sorted_x.
The schema gate folds into LFQueryBuilder.check_line_x. An unknown
downsample value now raises at construction instead of running as
nth.

Stage 2 cost on an M5, best of 5: the LTTB pass 1.1 ms at n_points
1000 and 28 ms at the 25000 cap; the fpcs walk 0.2 ms and 5.2 ms.
Full request on 2M rows, n_points 1000: lttb 18 ms resident and
21 ms scan against minmax 15 and 19; fpcs 13 and 19.
Add the lttb bullet to the downsampling guide and Architecture, with
the fixed 4x prefetch, the exact-n_points rule, and its limits: no
grouping, no cube. Correct the fpcs entries: x-width buckets when
ungrouped, row-count when grouped, output up to about 2 * n_points
and fewer on gappy x, and a different point set from the scan plan
on an exact y plateau. Replace the deleted fpcs kernel entries with
minmax_pairs_line.

Describe the contract seam: the trace declares its rules, the
builder verifies the data and keeps the sorted memo, and the engine
checks every line on every request before domain resolution. A bad
x or y now fails on the first request, not at add_line.
Base automatically changed from feat/line-xwidth to main September 8, 2026 13:11
@jvdd
jvdd merged commit d93d4e9 into main Sep 8, 2026
14 checks passed
@jvdd
jvdd deleted the feat/line-lttb-fpcs branch September 8, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant