[PR #6922] Skip DX invalidation if we've already scrolled an entire screen worth of height #26814

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

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

State: closed
Merged: Yes


We spend a lot of time invalidating in the DX Renderer. This is a
creative trick to not bother invalidating any further if we can tell
that the bitmap is already completely invalidated. That is, if we've
scrolled at least an entire screen in height... then the entire bitmap
had to have been marked as invalid as the new areas were "uncovered" by
the InvalidateScroll command. So further setting invalid bits on top
of a fully invalid map is pointless.

Note: I didn't use bitmap::all() here because it is significantly
slower to check all the bits than it is to just reason out that the
bitmap was already fully marked.

Validation Steps Performed

  • Run time cat big.txt. Checked average time before/after, WPR traces
    before/after.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/6922 **State:** closed **Merged:** Yes --- We spend a lot of time invalidating in the DX Renderer. This is a creative trick to not bother invalidating any further if we can tell that the bitmap is already completely invalidated. That is, if we've scrolled at least an entire screen in height... then the entire bitmap had to have been marked as invalid as the new areas were "uncovered" by the `InvalidateScroll` command. So further setting invalid bits on top of a fully invalid map is pointless. Note: I didn't use `bitmap::all()` here because it is significantly slower to check all the bits than it is to just reason out that the bitmap was already fully marked. ## Validation Steps Performed - Run `time cat big.txt`. Checked average time before/after, WPR traces before/after.
claunia added the pull-request label 2026-01-31 09:18:18 +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#26814