Skip to content

A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.

perf(gui): reuse the content view's frame heap across frames

RoversXa3a980354154
diff --git a/wezterm-gui/src/termwindow/render/paint.rs b/wezterm-gui/src/termwindow/render/paint.rs
index 4f6143c8..01f856a9 100644
--- a/wezterm-gui/src/termwindow/render/paint.rs
+++ b/wezterm-gui/src/termwindow/render/paint.rs
@@ -1674,7 +1674,13 @@ impl crate::TermWindow {
// them back -- is what makes an arrival look like several things
// happening near each other rather than one thing happening.
let composites_before = self.card_composites.borrow().len();
- let mut heap = HeapQuadAllocator::default();
+ // Record into last frame's buffers. A settled view records the same
+ // surface every frame; dropping that heap to allocate its twin was
+ // one large free and one large malloc per frame for the life of
+ // the view. Nothing reads the previous recording once this frame's
+ // begins: the closing ghost is taken before any frame is painted.
+ let mut heap = self.content_view_last_frame.take().unwrap_or_default();
+ heap.recycle();
{
let mut recorded = TripleLayerQuadAllocator::Heap(&mut heap);
self.paint_content_view(&mut recorded)?;