Skip to content

smoother scrolling on macos - #31023

Open
teidesu wants to merge 3 commits into
telegramdesktop:devfrom
teidesu:scroll-perf-fixes
Open

teidesu wants to merge 3 commits into
telegramdesktop:devfrom
teidesu:scroll-perf-fixes

Conversation

@teidesu

@teidesu teidesu commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

an attempt to make scrolling the chat history smoother on macos. two parts: render scroll positions with sub-pixel precision (needs desktop-app/lib_ui#324), and stop decoding images on the main thread, which caused visible stutter while scrolling media-heavy chats. it's not perfect but noticeably smoother.

  • skip thumbnail bytes generation for local stickers — local stickers were re-encoding a WEBP thumbnail that was never used; skip it via a new generateThumbnailBytes flag.
  • decode sticker images without blocking the main thread — checkStickerLarge constructed the Image (synchronous decode) on the main thread; move the decode to crl::async with a loading guard.
  • decode downloaded and partial cached images asynchronously — FileLoader now also decodes partial:-prefixed cache entries off-thread when the partial data covers the requested size, and decodes freshly downloaded images on crl::async before firing updates instead of leaving it to the consumer on the main thread.
  • apply sub-pixel scroll offset in history view — HistoryInner subscribes to the scroll view's sub-pixel offset, translates painting by the fraction (keeping the floating date badge and forum bar pinned) and compensates in all hit-testing paths.

note: the code in this pr was written partially by claude fable 5 and partially by gpt-5.6-sol.

@Prana111025 Prana111025 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

@teidesu

teidesu commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

removed subpixel scrolling related changes as per desktop-app/lib_ui#324 (comment)

keeping the async decoding fixes still

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants