Commit 08ad6e8
authored
[3/4] TUI: reuse retained text measurements (#14585)
## 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-NONE1 parent 2ede883 commit 08ad6e8
3 files changed
Lines changed: 62 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
50 | 55 | | |
51 | 56 | | |
52 | 57 | | |
| |||
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
| 64 | + | |
59 | 65 | | |
60 | 66 | | |
61 | 67 | | |
| |||
75 | 81 | | |
76 | 82 | | |
77 | 83 | | |
| 84 | + | |
78 | 85 | | |
79 | 86 | | |
80 | 87 | | |
| |||
88 | 95 | | |
89 | 96 | | |
90 | 97 | | |
| 98 | + | |
91 | 99 | | |
92 | 100 | | |
93 | 101 | | |
94 | 102 | | |
95 | 103 | | |
96 | 104 | | |
97 | 105 | | |
| 106 | + | |
98 | 107 | | |
99 | 108 | | |
100 | 109 | | |
| |||
262 | 271 | | |
263 | 272 | | |
264 | 273 | | |
265 | | - | |
266 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
267 | 282 | | |
268 | 283 | | |
269 | 284 | | |
270 | 285 | | |
271 | 286 | | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
276 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
277 | 298 | | |
278 | 299 | | |
279 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
72 | 100 | | |
73 | 101 | | |
74 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
150 | 156 | | |
151 | 157 | | |
152 | 158 | | |
| |||
171 | 177 | | |
172 | 178 | | |
173 | 179 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 180 | + | |
178 | 181 | | |
179 | 182 | | |
180 | 183 | | |
| |||
0 commit comments