[PR #6918] Cache the viewport to make invalidation faster #26810

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

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

State: closed
Merged: Yes


In Renderer::TriggerRedraw, the act of fetching the viewport from the
pData over and over is wasted time. We already have a cached variable
of the viewport that is updated on every scroll check (on
TriggerScroll and on PaintFrame.) Scrolling wouldn't be working
correctly if the clients weren't already notifying us that the viewport
has changed for scroll purposes, so we can just keep using that cached
value for the invalidation restriction to speed things up over fetching
it again.

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/6918 **State:** closed **Merged:** Yes --- In `Renderer::TriggerRedraw`, the act of fetching the viewport from the `pData` over and over is wasted time. We already have a cached variable of the viewport that is updated on every scroll check (on `TriggerScroll` and on `PaintFrame`.) Scrolling wouldn't be working correctly if the clients weren't already notifying us that the viewport has changed for scroll purposes, so we can just keep using that cached value for the invalidation restriction to speed things up over fetching it again. ## 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:17 +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#26810