diff options
| author | Adam Soltys <[email protected]> | 2026-09-10 22:47:05 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-09-10 22:47:05 -0700 |
| commit | ac675185e362930f2086e01ab578fdd3423e4c79 (patch) | |
| tree | 78928f4a0431de24c3797fa18e90edf85ad3b766 /src/app.js | |
| parent | 4260b7469bd487e574f97bdf99db31abf2caaa67 (diff) | |
| download | coinosv3-ac675185e362930f2086e01ab578fdd3423e4c79.tar.gz coinosv3-ac675185e362930f2086e01ab578fdd3423e4c79.zip | |
Keep a thumbnail of every face, so they're on screen in the first frame.
A profile picture is whatever its owner uploaded, and that is very often the
full-size original. Measured against the faces this wallet had cached: one
avatar is a 4,988,208-byte JPEG, another 3,901,966 — megabytes fetched and
decoded to paint a 30px circle. That is the second of blank circles on the
messages page after a refresh, and it repeats every time the upstream cache
header expires.
So the first time we see a picture we downscale it once (96px, webp) and keep
the thumbnail beside the profile in localStorage, which is read synchronously
at boot. Small avatars then paint from it alone and never ask the network for
the original again; the 64px profile avatar layers them, so the thumbnail
shows instantly while the full-size original loads over the top.
Reading the pixels needs CORS — most avatar hosts allow it (6 of the 9 here),
and the ones that don't are remembered as failures rather than retried every
boot. A refresh of the profile carries the thumbnail across when the picture
hasn't changed. Thumbnails live on a 180k budget, oldest face first, and Data
Saver opts out of making them at all.
tools/avatar-thumb-test.js watches a wallet meet a large cross-origin picture
and checks the next boot fetches no picture at all.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019mrt228Upn9nNCwGixzSLx
Diffstat (limited to 'src/app.js')
0 files changed, 0 insertions, 0 deletions
