Skip to content

perf(mecatui): profile long-transcript viewport replacement #1273

Open

Description

@jbeda

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.

Activity

  1. self-assigned this
    on Sep 8, 2026
  2. added
    flake
    tui
    and removed
    flake
    on Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

tui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions