Skip to content

Make TUI more responsive when scrolling#1555

Merged
krissetto merged 1 commit intodocker:mainfrom
krissetto:tui-scroll-perf
Feb 2, 2026
Merged

Make TUI more responsive when scrolling#1555
krissetto merged 1 commit intodocker:mainfrom
krissetto:tui-scroll-perf

Conversation

@krissetto
Copy link
Contributor

Coalesce mouse scroll events so we don't backlog the render pipeline with a ton of events.

This improves CPU performance when scrolling with a mouse/trackpad by 8-12x, while making the TUI much more responsive, even on large high res screens and with many long messages in the session. Where the scroll rendering used to lag behind the mouse scroll, continuing well after the user stopped scrolling, now its way more reactive to user input

Also includes:

  • caching rendered output in lines instead of a single string, avoiding split/joins on every render and reducing cpu usage by roughly 15-20% and mem usage by 25-50% for message rendering (based on number of messages etc)
  • caching sidebar render to avoid needless redraws

Screencasts

before

⚠️ When i wiggle the mouse, i have already stopped scrolling, but the TUI is lagging behind even on a very fast cpu

Screencast.From.2026-02-02.10-23-28.mp4

after

scroll rendering stops as soon as i stop scrolling

Screencast.From.2026-02-02.10-22-34.mp4

Signed-off-by: Christopher Petito <[email protected]>
@krissetto krissetto requested a review from a team as a code owner February 2, 2026 09:39
@krissetto krissetto merged commit 77a6b31 into docker:main Feb 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants