Repository navigation
fix: avoid per-cell allocations in terminal text reads - #4845
Conversation
|
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 configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe terminal library adds Suggested reviewers: Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The change reuses grapheme storage for row reads while preserving pane text handling. The supplied evidence identifies no actionable merge blocker. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 2 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
|
Regarding the docstring-coverage warning, including the updated 30% result on 7a5574a: the public visitor documents its borrowed-slice lifetime and out-of-range behavior, the test allocator module documents its counting scope, and the owned helper now explains its distinct allocation policy. The remaining private helpers and tests follow existing conventions. No missing API contract was identified, so I am not adding repetitive comments solely to meet the percentage. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review Please review final head 7a5574a, which restores tight allocations for owned grapheme reads while preserving row-buffer reuse. |
✅ Action performedReview finished.
|
* fix: avoid per-cell allocations in terminal text reads refs herdrdev#4506 * fix: preserve tight allocations for owned grapheme reads refs herdrdev#4506 --------- Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com> Co-authored-by: JJ Liebig <jonathan.liebig@gmail.com> (cherry picked from commit 65e35a3)
* fix: avoid per-cell allocations in terminal text reads refs herdrdev#4506 * fix: preserve tight allocations for owned grapheme reads refs herdrdev#4506 --------- Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com> Co-authored-by: JJ Liebig <jonathan.liebig@gmail.com>
Issue
Running many agents that redraw their terminals can make the Linux server burn several CPU cores. Snapshot requests then intermittently take seconds.
Problem
Reading terminal text allocated a separate grapheme vector for each populated cell. Concurrent reads fought over musl's allocator lock before assembling the same text into strings.
How did we fix it?
Herdr now reuses one grapheme buffer while reading each row. Text normalization and detection behavior stay unchanged. Consumers that need owned cell snapshots keep their existing API.
Verification
The reported agent-free workload reproduced on unchanged master: 24 working 330×119 panes used 2.78–3.24 cores, with snapshot calls reaching 1.76 seconds. Matched fixed runs used 0.336–0.338 cores; all 30 snapshot calls took 6–12 ms. Output throughput increased and all panes remained working. Both sessions were cleaned up; remote reconnect recovery remains unverified.
Tests protect cell equivalence, row allocation scaling, and tight owned-cell capacity.
just checkpassed 3,898 Rust tests and its other checks, including Windows cross-lint. Six render-scale profiles passed; the native-file profile could not complete because this host lacks required CoW/reflink support.refs #4506