[PR #6840] Cache VT buffer line string to avoid (de)alloc on every paint #26790

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

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

State: closed
Merged: Yes


PR Checklist

  • Closes perf itch
  • I work here
  • Manual test
  • Documentation irrelevant.
  • Schema irrelevant.
  • Am core contributor.

Detailed Description of the Pull Request / Additional comments

A lot of time was spent between each individual line in the VT paint engine in allocating some scratch space to assemble the clusters then deallocating it only to have the next line do that again. Now we just hold onto that memory space since it should be approximately the size of a single line wide and will be used over and over and over as painting continues.

Validation Steps Performed

  • Run time cat big.txt under WPR. Checked before and after perf metrics.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/6840 **State:** closed **Merged:** Yes --- ## PR Checklist * [x] Closes perf itch * [x] I work here * [x] Manual test * [x] Documentation irrelevant. * [x] Schema irrelevant. * [x] Am core contributor. ## Detailed Description of the Pull Request / Additional comments A lot of time was spent between each individual line in the VT paint engine in allocating some scratch space to assemble the clusters then deallocating it only to have the next line do that again. Now we just hold onto that memory space since it should be approximately the size of a single line wide and will be used over and over and over as painting continues. ## Validation Steps Performed - Run `time cat big.txt` under WPR. Checked before and after perf metrics.
claunia added the pull-request label 2026-01-31 09:18:10 +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#26790