[PR #6483] Recycle assorted rendering components to accelerate drawing #26706

Open
opened 2026-01-31 09:17:39 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/6483

State: closed
Merged: Yes


This saves an awful lot of construction/destruction and memory
allocation, especially with text that changes a lot (see: cacafire).

Three things:

  1. Recycling the text layouts. This holds onto the CustomTextLayout so
    all the things that don't change related to drawing targets and
    whatnot aren't freed and recreated every frame.
  2. Reordering the runs in place. This saves a vector
    allocation/copy/delete every time OrderRuns is called. They can be
    rearranged in place.
  3. Only clip once per row. This reduces the clip push/pop to only one
    time per row. Since we're always redrawing an entire row at a time,
    this saves a lot of alloc/free of the clip frame, dramatically
    reduces queued commands, and makes less work on the flush since
    clipping requires staging the drawing and then bringing it back to
    the main surface.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/6483 **State:** closed **Merged:** Yes --- This saves an awful lot of construction/destruction and memory allocation, especially with text that changes a lot (see: cacafire). Three things: 1. Recycling the text layouts. This holds onto the `CustomTextLayout` so all the things that don't change related to drawing targets and whatnot aren't freed and recreated every frame. 2. Reordering the runs in place. This saves a vector allocation/copy/delete every time OrderRuns is called. They can be rearranged in place. 3. Only clip once per row. This reduces the clip push/pop to only one time per row. Since we're always redrawing an entire row at a time, this saves a lot of alloc/free of the clip frame, dramatically reduces queued commands, and makes less work on the flush since clipping requires staging the drawing and then bringing it back to the main surface.
claunia added the pull-request label 2026-01-31 09:17:39 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26706