Skip to content

Commit fbdaa82

Browse files
harryalbertoz-agent
andcommitted
TUI: benchmark running command viewport relayout
Co-Authored-By: Oz <oz-agent@warp.dev>
1 parent e4e37ad commit fbdaa82

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

crates/warp_tui/benches/transcript_bench.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ fn benchmark_running_agent_command(criterion: &mut Criterion) {
2323
let mut benchmark =
2424
TranscriptBenchmark::new(TranscriptDataset::RunningAgentCommand { rows }, 120, 50);
2525
group.bench_with_input(
26-
BenchmarkId::new("retained_unchanged_frame", rows),
26+
BenchmarkId::new("viewport_relayout_unchanged_frame", rows),
2727
&rows,
28-
|b, _| b.iter(|| black_box(benchmark.present())),
28+
|b, _| {
29+
b.iter(|| {
30+
benchmark.invalidate_viewport();
31+
black_box(benchmark.present())
32+
})
33+
},
2934
);
3035
}
3136
group.finish();

crates/warp_tui/src/benchmark_support.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,18 @@ impl TranscriptBenchmark {
282282
})
283283
}
284284

285+
/// Re-renders the transcript viewport without dirtying retained agent blocks.
286+
pub fn invalidate_viewport(&mut self) {
287+
let invalidation = WindowInvalidation {
288+
updated: EntityIdSet::from_iter([self.root.id()]),
289+
..Default::default()
290+
};
291+
self.app.read(|ctx| {
292+
self.presenter
293+
.invalidate(&invalidation, ctx, self.root.window_id(ctx));
294+
});
295+
}
296+
285297
/// Re-renders the root and long agent block before the next frame.
286298
pub fn invalidate_all(&mut self) {
287299
let mut updated = EntityIdSet::from_iter([self.root.id()]);

0 commit comments

Comments
 (0)