[1/4] TUI: add retained transcript performance benchmarks - #14575
Conversation
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds a Criterion benchmark target for retained Warp TUI transcript rendering, along with test-util-gated benchmark support fixtures that exercise real App/TuiPresenter/TuiAIBlock/block-list paths. It does not change runtime rendering behavior.
Concerns
- No blocking correctness, security, or spec-alignment concerns found in the annotated diff.
spec_context.mdreports that no approved or repository spec context was found, so there were no concrete spec commitments to validate against.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds Criterion benchmarks and test-only fixture support for measuring retained TUI transcript rendering scenarios. The benchmark fixture is generally scoped to dev/test-only code, and I did not find security issues. No approved spec context was available for implementation-drift checks.
Concerns
- The retained benchmark path currently calls
present()without first puttingTuiPresenterinto its no-op invalidated frame state, soTuiPresenter::presenttakes the direct-render fallback for the root view rather than the cachedlast_elementpath. That makes the retained baseline measure a different path than the benchmark name and PR description claim.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| } | ||
|
|
||
| /// Paints one frame from retained view elements and returns a cheap checksum. | ||
| pub fn present(&mut self) -> u64 { |
There was a problem hiding this comment.
TuiPresenter::present only reuses last_element when invalidate() ran for the frame; calling this directly leaves invalidated_this_frame false and takes the direct root-render fallback, so the retained_* benchmark cases rebuild BenchmarkTranscriptView instead of measuring the retained root path. Add a retained-frame method that runs a no-op WindowInvalidation::default() before present(), while keeping invalidate_all() for the invalidated cases.
## Description Stack 2 of 4. Removes the full-height scratch buffer from `TuiClipped` and paints children directly through a nested, buffer-enforced clip. `TuiText` supplies the logical row offset to ratatui so only the visible paragraph window is painted. The clip is enforced for cell, style, and widget writes; it is not only scene/hit-test metadata. Regression coverage includes nested clipping, translated rows, negative bounds, cursor visibility, and a retained long child that must not overwrite simulated input/footer rows. Benchmark at 120×50 versus stack PR 1: - Many completed blocks, 10,000: 64.0 → 29.1 µs/frame (55% faster). - Retained rich response, 1,000 rows: 2.30 → 0.925 ms (60% faster). - Retained rich response, 10,000 rows: 24.5 → 8.56 ms (65% faster). - Invalidated rich response, 10,000 rows: 25.7 → 9.38 ms (63% faster). - Retained streaming tail at end, 10,000 rows: 33.9 → 17.2 ms (49% faster). Stack: #14575 ← **2/4** → `oz/tui-retained-frame-overhead` → `oz/tui-streaming-height-reconciliation`. Agent conversation: https://staging.warp.dev/conversation/2b6af7be-b227-4b20-aaf4-23c9a8494b81 Stack plan: https://staging.warp.dev/drive/notebook/yM2YcQsILFsFzwixBDbD9p Performance plan: https://staging.warp.dev/drive/notebook/LHzsFd1B8XbQ8AnUqB88LS ## Linked Issue N/A — Warp Agent CLI transcript rendering performance. ## Testing - `cargo nextest run -p warpui_core --features tui` — 555 passed, 7 skipped. - `cargo nextest run -p warp_tui` — 902 passed. - Strict Clippy passed for `warpui_core --features tui` and `warp_tui --features test-util`. - `cargo bench -p warp_tui --features test-util --bench transcript_bench` - `./script/format` - Signed-in 120×40 tmux PTY: zero state and unsent input repainted correctly. - [x] I have manually tested my changes locally with `./script/run-tui` ## Agent Mode - [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode CHANGELOG-IMPROVEMENT: Improved scrolling and typing performance for long Warp Agent CLI transcripts.
## Description Stack 3 of 4. Reuses `TuiText` natural measurements when retained content is laid out again at the same width, and avoids copying a viewport selection snapshot when there is no active selection and line-end trimming is disabled. This layer targets steady-state frame overhead after stack PR 2 has already bounded paint work. Width changes still recompute text measurement, and selection snapshots remain enabled whenever selection or trimmed line-end behavior needs them. Benchmark at 120×50 versus stack PR 2: - Retained rich response, 1,000 rows: 0.925 → 0.129 ms (86% faster). - Retained rich response, 10,000 rows: 8.56 → 0.598 ms (93% faster). - Retained middle frame, 10,000 rows: 8.41 → 0.395 ms (95% faster). - Retained streaming tail at end, 10,000 rows: 17.2 → 9.88 ms (42% faster). - Invalidated rich response, 10,000 rows: 9.38 → 9.85 ms (~5% slower). - Many completed blocks, 10,000: 29.2 → 31.6 µs/frame (~8% slower, still flat with history depth). The next stack layer removes the remaining repeated streaming-height work and owns auto-scroll reconciliation. Stack: #14575 ← #14582 ← **3/4** → `oz/tui-streaming-height-reconciliation`. Agent conversation: https://staging.warp.dev/conversation/2b6af7be-b227-4b20-aaf4-23c9a8494b81 Stack plan: https://staging.warp.dev/drive/notebook/yM2YcQsILFsFzwixBDbD9p Performance plan: https://staging.warp.dev/drive/notebook/LHzsFd1B8XbQ8AnUqB88LS ## Linked Issue N/A — Warp Agent CLI retained-frame performance. ## Testing - `cargo nextest run -p warpui_core --features tui` — 555 passed, 7 skipped. - `cargo nextest run -p warp_tui` — 902 passed. - Strict Clippy passed for `warpui_core --features tui` and `warp_tui --features test-util`. - `cargo bench -p warp_tui --features test-util --bench transcript_bench` - `./script/format` - Signed-in 120×40 tmux PTY: zero state and unsent input repainted correctly. - [x] I have manually tested my changes locally with `./script/run-tui` ## Agent Mode - [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode CHANGELOG-NONE

Description
Stack 1 of 4. Adds a retained Criterion benchmark for long Warp Agent CLI transcripts using the real
App,TuiPresenter, terminal block list, viewport state, andTuiAIBlock.This PR intentionally changes no runtime rendering behavior. Later stack layers use this benchmark to isolate bounded painting, retained-frame overhead, and streaming height reconciliation.
Baseline at 120×50:
Stack: 1/4 →
oz/tui-bounded-viewport-paint→oz/tui-retained-frame-overhead→oz/tui-streaming-height-reconciliation.Agent conversation: https://staging.warp.dev/conversation/2b6af7be-b227-4b20-aaf4-23c9a8494b81
Stack plan: https://staging.warp.dev/drive/notebook/yM2YcQsILFsFzwixBDbD9p
Performance plan: https://staging.warp.dev/drive/notebook/LHzsFd1B8XbQ8AnUqB88LS
Linked Issue
N/A — performance benchmark foundation.
Testing
cargo nextest run -p warp_tui— 902 passed.cargo clippy -p warp_tui --all-targets --features test-util -- -D warningscargo bench -p warp_tui --features test-util --bench transcript_bench./script/formatI have manually tested my changes locally with
./script/runAgent Mode
CHANGELOG-NONE