Avatars: scaled down once, fetched light, redrawn one at a time #266

Merged
littlefox merged 2 commits from issue-239-avatars into main 2026-10-22 05:09:59 +00:00
Owner

Closes #239

  • The picture is scaled to 192 px on a canvas in the webview (WebP, PNG where the webview can't), same in the browser and on the desktop, and only that is kept: not a several-MB photo as a data URL for a 32 px circle.
  • Kom::avatar takes the presentation as a preview (no stat per comment to it, and seeing it isn't reading a FAQ).
  • Each avatar follows only its own person's cache entry (a memo), so one arriving picture redraws one avatar, not all.

Measured with tools/perf.sh (three authors have a 100 KB picture): after 25 pages of a channel's posts the app's wasm memory is 33 MB, down from 89 MB.

Verified: profile spec (now posts a 600 px picture and checks the avatar is drawn from ≤192 px), side-column, presence, thread and channel-posts specs on three profiles, 33 passed; screenshot of the profile looked at; lint three ways.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8

Closes #239 - The picture is scaled to 192 px on a canvas in the webview (WebP, PNG where the webview can't), same in the browser and on the desktop, and only that is kept: not a several-MB photo as a data URL for a 32 px circle. - `Kom::avatar` takes the presentation as a preview (no stat per comment to it, and seeing it isn't reading a FAQ). - Each avatar follows only its own person's cache entry (a memo), so one arriving picture redraws one avatar, not all. Measured with `tools/perf.sh` (three authors have a 100 KB picture): after 25 pages of a channel's posts the app's wasm memory is **33 MB, down from 89 MB**. Verified: profile spec (now posts a 600 px picture and checks the avatar is drawn from ≤192 px), side-column, presence, thread and channel-posts specs on three profiles, 33 passed; screenshot of the profile looked at; lint three ways. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8
An avatar kept the presentation's first picture at full size as a data
URL (people paste photos of several MB there), fetched it as a full view
(a stat for every comment to the presentation, and seeing it counted as
reading a FAQ), and every avatar read the whole cache, so each picture
that arrived redrew every avatar and copied its string. Now the picture
is scaled to 192 px on a canvas (WebP, PNG where the webview can't), the
presentation comes as a preview, and each avatar follows only its own
person. After 25 pages of a channel's posts the app's memory is 33 MB,
down from 89 MB.

Closes #239

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8
Merge remote-tracking branch 'origin/main' into issue-239-avatars
All checks were successful
ci / check (push) Successful in 10m39s
ci / desktop (push) Successful in 15m57s
ci / e2e (push) Successful in 30m13s
137f45b48c
littlefox referenced this pull request from a commit 2026-10-22 14:11:06 +00:00
Sign in to join this conversation.
No description provided.