Skip to content

Desktop: long chats: transcript layout, streamed markdown, scroll bench (#473) - #486

Merged
MopigamesYT merged 4 commits into
perf/auditfrom
perf/473-transcript
Nov 17, 2026
Merged

MopigamesYT merged 4 commits into
perf/auditfrom
perf/473-transcript

Conversation

@MopigamesYT

@MopigamesYT MopigamesYT commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Part of #473. Stacked on #477 (perf/audit).

Changes

  • Transcript layout: prefix sums of row heights, O(1) change tracking, linear open; visible rows already measured at the current width are no longer re-measured each frame. New transcript_layout_test.go.
  • Markdown streaming: only the changed tail is reparsed; off-screen flowText caches are freed.
  • Scroll bench: marks the canvas dirty, as a wheel does, instead of calling canvas.Refresh(scroll), which freed the textures of the whole transcript on every step.

Measurements (VM 111, i5-10210U, 3 vCPU, synthetic state)

Headless benchmarks, before → after:

Benchmark Before After Target
TranscriptLayout/4000 560 µs 42 µs ≤ 50 µs ✅
ScrollStep 1.58 ms 0.20 ms ≤ 150 µs ❌ (close)
StreamDelta/4000 4.89 ms 1.72 ms ≤ 0.3 ms ❌
MarkdownParse 316 µs 22 µs —
OpenChat/4000 cached=false 862 ms, 231 MB 582 ms, 234 MB ≤ 250 ms, ≤ 120 MB ❌

In-app runs on llvmpipe (both builds use the fixed scroll bench):

Scenario Before After
scroll fps / frame p99 43 fps / 32.5 ms 45 fps / 24.8 ms
stream fps / frame p99 31 fps / 42.9 ms 32 fps / 36.9 ms

Stream on virgl (4,000-row chat, 10 s), before → after:

Metric Before After Target
Stream CPU 62.2 % 50.3 % ≤ 25 % ❌
Stream frame p99 19.9 ms 23.1 ms ≤ 16 ms ❌
fps 35 36

Soak: 570 s of streaming on virgl. The memory figures are the app's own snapshots at the start and end of the streaming span:

Metric Before After Target
Heap growth over the span +71.6 MB (132 → 204) +26.3 MB (133 → 159) ≤ +20 MB ❌ (close)
RSS growth over the span +191 MB (387 → 579) +94 MB (393 → 486) —
CPU over the soak 79.2 % 69.7 %
fps / frame p99 32 / 33.4 ms 36 / 33.1 ms

The profiles show that paint and the object-tree walk in Fyne now take most of each frame, and stream allocations (~1.5 MB per delta) still dominate StreamDelta.

🤖 Generated with Claude Code

…aches freed off screen (#473)

Assisted-by: Claude Opus 5.5 low
… linear open (#473)

Visible rows already measured at the current width are no longer
re-measured each frame. Adds transcript layout tests.

Assisted-by: Claude Opus 5.5 low
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