chart: scalar per-point mapping + vline/hline ctors; de-flake [62] capture (#828, #876) - #878
Merged
Merged
Conversation
…rs; de-flake [62] capture (#828, #876) Closes #828. Closes #876. - lib/ui_w_viz.eigs: the series hot loop no longer calls _chart_map (a fresh 2-element list per plotted point per frame — ~37% of the frame at 4,000 points by ceiling probe, and an #827 pinning amplifier under armed history). The mapping is inlined scalar with hoisted view factors; every other _chart_map site is cold and keeps the readable form. Measured n=5 medians (4,000-pt points series, dummy driver): baseline 62.7 ms/frame, ceiling 39.6, shipped 42.6 — 87% of the probed ceiling, 1.47x. A [63] check pins the inline mapping to chart_to_pixel's exact floored pixels. - chart_vline(x, label, color) / chart_hline(y, label, color): the same markers without the dead coordinate chart_marker forces callers to invent (#828 part 2). Docs + [63] constructor checks. - tests/test_audio.eigs (#876): an opened capture device that delivers no samples in the bounded poll is an environment statement, not a runtime failure — the delivery-dependent checks now SKIP with the count held constant (the file's existing no-device convention). A delivering device still runs every check against the real driver. This was the unexplained 38-fail suite run: [62] lump-counts. Validated: full suite 3815/3815 against the gfx build; [62] 53/53 in all three modes (delivering device, silent device, dummy driver). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses two user-facing issues in the UI chart and test suite: it removes per-point list allocation from the chart render hot loop (improving high-point-count throughput) and deflakes the audio capture test section by treating “opened but silent” capture devices as an environment skip rather than a runtime failure.
Changes:
- Inlined chart data→pixel mapping as scalar arithmetic in
_render_chart’s per-point loop, hoisting view factors out of the inner loop to avoid per-point allocations. - Added
chart_vline/chart_hlineconstructors to avoid requiring callers to pass an ignored coordinate for vline/hline markers. - Updated tests/docs/changelog: pinned mapping correctness against
chart_to_pixel, and adjusted audio capture tests to skip delivery-dependent checks when a device opens but delivers no samples.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_ui.eigs | Adds a regression check that recorded point-dot rects match chart_to_pixel’s mapped pixels; covers new marker constructors. |
| tests/test_audio.eigs | Deflakes capture tests by skipping delivery-dependent assertions when capture opens but yields no samples (environment condition). |
| lib/ui_w_viz.eigs | Implements scalar per-point mapping in the chart render loop and adds chart_vline/chart_hline. |
| docs/STDLIB.md | Documents the new marker constructors. |
| CHANGELOG.md | Records the chart performance improvement and the audio capture flake fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+154
to
+158
| assert_eq of [1, 1, "capture delivery skipped (silent device, #876)"] | ||
| assert_eq of [1, 1, "capture delivery skipped (silent device, #876)"] | ||
| assert_eq of [1, 1, "capture delivery skipped (silent device, #876)"] | ||
| assert_eq of [1, 1, "capture delivery skipped (silent device, #876)"] | ||
| assert_eq of [1, 1, "capture delivery skipped (silent device, #876)"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #828. Closes #876.
#828.1 — per-point allocation in the chart render loop
Reproduced the consumer's measurement locally (4,000-point points-style series, four vline markers, hover off,
SDL_VIDEODRIVER=dummy, n=5 medians): 62.7 ms/frame baseline. A semantics-breaking ceiling probe (mapping replaced by constants) measured 39.6 ms/frame — the_chart_maplist-per-point was ~37% of the frame, confirming the report before building the fix.The shipped fix inlines the mapping as scalar arithmetic in the hot loop with the view factors hoisted (
_chart_mapstays for the cold sites: ticks, markers, hover,chart_to_pixel). Shipped: 42.6 ms/frame (n=5 median) — 87% of the probed ceiling, 1.47×. Also removes the #827 amplifier (per-point lists pinned under armed history: +3.9 MB/frame in the dynamics consumer).Correctness pin: a new [63] check renders a 2-point series and asserts the recorded dot rects sit at exactly
chart_to_pixel's floored pixels — the inline and the readable form cannot drift apart silently.#828.2 — dead marker coordinate
chart_vline(x, label, color)/chart_hline(y, label, color)— the same marker dict without the coordinate the kind ignores. Docs row + constructor checks.#876 — [62] audio capture flake (folded, found while landing this)
Two full-suite runs today reported 38 failures with no code cause: a real capture device that OPENS but delivers no samples in the 2s bounded poll fails two delivery checks, and [62] lump-counts all 38. Reproduced 2-in-3 against the real driver; 3/3 green under
SDL_AUDIODRIVER=dummy. The delivery-dependent checks now SKIP with the count held constant (the file's existing no-device convention), keeping full real-driver coverage on boxes where capture delivers. [62] verified 53/53 in all three modes.Validation
--linton touched files: no new warnings.Closes #828. Closes #876.
🤖 Generated with Claude Code