perf(mecatui): profile long-transcript viewport replacement
@jbeda is already working on this.
Since Sep 8, 2026.
- Dominant language
- Go
- Stars
- 152
- Forks
- 16
- Avg merge
- 14h 48m
- Merged PRs (30d)
- 536
Description
Problem
viewport.Model.SetContentLines receives the whole rendered transcript on each viewport replacement. Even when mecatui's renderer reuses cached block output, Bubble Tea scans every supplied line for embedded newlines and recomputes longest display width across the full transcript. This is O(total rendered characters) per replacement on the newline-free path.
Long transcripts can therefore make scrolling slow, especially with an active selection, where selection projection causes additional viewport content replacement.
Scope
Profile the full mecatui render → viewport replacement path on long transcripts, separately attributing:
- block/frame rendering and provenance assembly;
viewport.Model.SetContentLinesnewline scan and width measurement;- scroll, resize, streaming update, and active-selection paths;
- allocations, CPU, and RSS.
If viewport replacement dominates, design and evaluate a virtualized/incremental viewport that retains the full logical frame/provenance in mecatui while supplying Bubble Tea only visible rows plus bounded overscan. Preserve logical anchors, tail-follow, selection, resize behavior, and newline-free row invariants.
Non-goals
- Do not preemptively introduce virtualization without profile evidence.
- Do not weaken logical selection or anchor correctness.
- Do not change protocol/session persistence; this is a mecatui-local performance investigation.
Acceptance
- Reproducible benchmark/profile evidence identifies the dominant cost on a long transcript.
- The issue records whether virtualization is justified and, if so, a bounded implementation plan with correctness/performance tests.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.