[PR #6924] Dig directly into text buffer with render base for perf #26819

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

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

State: closed
Merged: No


The act of working with Clusters creates a lot of overhead for the assorted engines when they really treat things rather similarly in terms of a string and a "cluster map" of sorts of which characters belong to which columns. The inspiration for this comes from how DirectWrite gives us this information when we do an analysis as it turns out to be rather efficient.

I'm still not sold on this as the location where this will happen. I'm thinking of moving it up even further such that the TextBuffer can either store the information in this order (to be able to NxM at its own level more easily). Or perhaps just making the IRenderData generate this into a copy location so it can happen under lock then unlock and let the render thread do the layout work while the IO thread can keep capturing.

Bunch of cleanup left to do here.

Validation Steps Performed

  • Run time cat big.txt. Checked average time before/after, WPR traces
    before/after.

PR Checklist

  • Closes perf itch
  • I work here
  • Manual test
  • Documentation irrelevant.
  • Schema irrelevant.
  • Am core contributor.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/6924 **State:** closed **Merged:** No --- The act of working with `Cluster`s creates a lot of overhead for the assorted engines when they really treat things rather similarly in terms of a string and a "cluster map" of sorts of which characters belong to which columns. The inspiration for this comes from how DirectWrite gives us this information when we do an analysis as it turns out to be rather efficient. I'm still not sold on this as the location where this will happen. I'm thinking of moving it up even further such that the `TextBuffer` can either store the information in this order (to be able to NxM at its own level more easily). Or perhaps just making the `IRenderData` generate this into a copy location so it can happen under lock then unlock and let the render thread do the layout work while the IO thread can keep capturing. Bunch of cleanup left to do here. ## Validation Steps Performed - Run `time cat big.txt`. Checked average time before/after, WPR traces before/after. ## PR Checklist * [x] Closes perf itch * [x] I work here * [x] Manual test * [x] Documentation irrelevant. * [x] Schema irrelevant. * [x] Am core contributor.
claunia added the pull-request label 2026-01-31 09:18:20 +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#26819