stacklok / stacklok/mecatl

perf(mecatui): profile long-transcript viewport replacement

Open
#1,273 0 comments 0 reactions 1 assignee View on GitHub

@jbeda is already working on this.

Since Sep 8, 2026.

tui
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.SetContentLines newline 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.