Skip to content

perf: avoid repeated scrollback page lookups - #4553

Merged
JJLiebig merged 3 commits into
masterfrom
issue/4506-scrollback-row-read
Sep 24, 2026
Merged

JJLiebig merged 3 commits into
masterfrom
issue/4506-scrollback-row-read

Conversation

@JJLiebig

Copy link
Copy Markdown
Collaborator

Summary

  • Read each recent/detection text row through the existing row-range API, so scrollback page resolution happens once per row instead of once per column.
  • Preserve wide-cell spacers, combining graphemes, Kitty image placeholders, trailing-space trimming, and detection reads from the bottom buffer when the viewport is scrolled.
  • Add one regression test for those text semantics.

Evidence

  • On Windows, paired optimized component timings (three runs) for a 554x109 pane with 27,997 retained rows improved from 35.095 ms to 1.213 ms (28.9x). An 80x24 pane with 60,001 retained rows improved from 297 us to 104 us (2.9x). The 80x24/10,001-row case moved from 93 us to 101 us.
  • These are text-read elapsed times, not whole-process CPU savings. Issue Server burns 10+ CPU cores with many populated agent panes #4506's 256-CPU Linux server load was not reproduced; this does not establish that its sustained CPU issue is fixed.
  • just check passed on Windows: 3,235 Rust tests, repository maintenance and UI architecture tests, integration asset tests, docs checks, formatting, and lint.
  • Review Suite fast rvw_622c6458: two clean signoffs.

Refs #4506

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 2ee82327-9101-408a-8c87-5f09ad38986d

📥 Commits

Reviewing files that changed from the base of the PR and between 8e10b67 and 45a6bdb.

📒 Files selected for processing (1)
  • src/pane/terminal.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Recent terminal text extraction now fetches each row with one screen_text_rows_range call instead of reading cells one column at a time. The callers no longer pass a column count. A new test checks combining characters, Kitty image placeholders, and detection text after scrolling.

Suggested reviewers: ogulcancelik

Merge Risk: ⚪ Minimal · up to 45a6b

Recent terminal text extraction has focused coverage for wide characters, and no merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main performance change: avoiding repeated scrollback page lookups.
Description check ✅ Passed The description directly explains the row-range API change, preserved text semantics, regression test, performance evidence, and validation results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kangal-bot

Copy link
Copy Markdown
Collaborator

@coderabbitai review
@greptileai

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

@kangal-bot, I’ll review #4553.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@greptile-apps

greptile-apps Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the optimized row access preserves the previous text extraction semantics and no outstanding defect was identified.

Summary

The PR optimizes Ghostty recent-output and detection reads by resolving each scrollback row once through the existing row-range API instead of resolving its backing page for every column.

  • Preserves wide-cell spacer, grapheme, image-placeholder, and whitespace behavior.
  • Adds regression coverage for combining text, image placeholders, scrollback, and detection reads.
  • The replacement row API retains the previous cell domain and ordering.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A[Recent or detection text request] --> B[Determine retained row range]
    B --> C[Resolve each scrollback row once]
    C --> D[Iterate row cells]
    D --> E[Preserve graphemes and wide-cell semantics]
    E --> F[Trim and return text]
Loading

Reviews (2) · Last reviewed commit: "Merge branch 'master' into issue/4506-sc..."

@JJLiebig

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review
@greptileai

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@JJLiebig
JJLiebig merged commit 8d64c34 into master Sep 24, 2026
7 checks passed
abhijit-s pushed a commit to abhijit-s/herdr that referenced this pull request Sep 25, 2026
Merges 9 upstream commits: native kitty graphics rendering replacing
the custom graphics API (herdrdev#4561, breaking), navigator search term
matching (herdrdev#4535), avoiding inferring codex idle from terminal output
(herdrdev#4563), Windows input coverage reporting and clipboard test fixes
(herdrdev#4566), qualified Win32/Kitty input path test defaults (herdrdev#4587),
reduced redundant client ANSI encoding work (herdrdev#4552), reduced repeated
scrollback page lookups (herdrdev#4553), tmux auto-attach guard docs (herdrdev#4592),
and keeping copy mode active during projection updates (herdrdev#4281).

refs upstream herdrdev/herdr@8d95e9bd
hdosys added a commit to hdosys/herdr-ext that referenced this pull request Oct 1, 2026
…ates

Adopt the stable cursor-settling sequence, row-based scrollback reads and redundant ANSI work reduction. Keep fork cursor color live during a position hold and do not skip metadata-only output when an OSC 12 color change or OSC 112 reset remains pending.

Upstream sources: 856b64b, d59d060, 21fd121, 8d64c34, afd9e19.

Refs herdrdev#4389, herdrdev#4404, herdrdev#4554, herdrdev#4553, herdrdev#4552, herdrdev#4303, herdrdev#4506, herdrdev#4546

Co-authored-by: JJ Liebig <[email protected]>
maciejul pushed a commit to maciejul/herdr-supercharged that referenced this pull request Oct 28, 2026
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.

2 participants