[PR #6919] Commit attr runs less frequently by accumulating length of color run #26817

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

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

State: closed
Merged: Yes


The act of calling InsertAttrRuns is relatively slow. Instead of
calling it a bunch of times to meddle with colors one cell at a time,
we'll accumulate a length of color and call it to make it act all at
once. This is great for when one color full line is getting replaced
with another color full line OR when a line is being replaced with the
same color all at once. There's significantly fewer checks to be made
inside InsertAttrRuns if we can help it out by accumulating the length
of each color before asking it to stitch it into the storage.

Validation

  • Run time cat big.txt and time cat ls.txt under VS Performance
    Profiler.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/6919 **State:** closed **Merged:** Yes --- The act of calling `InsertAttrRuns` is relatively slow. Instead of calling it a bunch of times to meddle with colors one cell at a time, we'll accumulate a length of color and call it to make it act all at once. This is great for when one color full line is getting replaced with another color full line OR when a line is being replaced with the same color all at once. There's significantly fewer checks to be made inside `InsertAttrRuns` if we can help it out by accumulating the length of each color before asking it to stitch it into the storage. Validation ---------- - Run `time cat big.txt` and `time cat ls.txt` under VS Performance Profiler.
claunia added the pull-request label 2026-01-31 09:18:19 +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#26817