[PR #16006] Improve performance of scrollbar marks #30803

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

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

State: closed
Merged: Yes


This replaces the use of a <Canvas> with an <Image> for drawing
scrollbar marks. Otherwise, WinUI struggles with the up to ~9000 UI
elements as they get dirtied every time the scrollbar moves.
(FWIW 9000 is not a lot and it should not struggle with that.)

The <Image> element has the benefit that we can get hold of a CPU-side
bitmap which we can manually draw our marks into and then swap them into
the UI tree. It draws the same 9000 elements, but now WinUI doesn't
struggle anymore because only 1 element gets invalidated every time.

Closes #15955

Validation Steps Performed

  • Fill the buffer with "e"
  • Searching for "e" fills the entire thumb range with white
  • ...doesn't lag when scrolling around
  • ...updates quickly when adding newlines at the end
  • Marks sort of align with their scroll position
**Original Pull Request:** https://github.com/microsoft/terminal/pull/16006 **State:** closed **Merged:** Yes --- This replaces the use of a `<Canvas>` with an `<Image>` for drawing scrollbar marks. Otherwise, WinUI struggles with the up to ~9000 UI elements as they get dirtied every time the scrollbar moves. (FWIW 9000 is not a lot and it should not struggle with that.) The `<Image>` element has the benefit that we can get hold of a CPU-side bitmap which we can manually draw our marks into and then swap them into the UI tree. It draws the same 9000 elements, but now WinUI doesn't struggle anymore because only 1 element gets invalidated every time. Closes #15955 ## Validation Steps Performed * Fill the buffer with "e" * Searching for "e" fills the entire thumb range with white ✅ * ...doesn't lag when scrolling around ✅ * ...updates quickly when adding newlines at the end ✅ * Marks sort of align with their scroll position ✅
claunia added the pull-request label 2026-01-31 09:43:05 +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#30803