Skip to content

The window's memory: a picture decoded at the size its URL asks (raea-w, raea-h) - #184

Merged
shinyobjectz merged 2 commits into
mainfrom
window-images
Nov 18, 2026
Merged

shinyobjectz merged 2 commits into
mainfrom
window-images

Conversation

@shinyobjectz

Copy link
Copy Markdown
Owner

The problem. A feed card draws a still at most 720 points wide (1440 pixels on a Retina screen), but raea's window decoded it at full size. A 2560×1440 still held 14.7 MB of RGBA. Measured with raea-feed's new e2e/memory.spec.ts (60 stills of 2560×1440, before this change):

Stage Footprint
Feed open 1131 MB
Scrolled to the end 2032 MB
Back at the top 2049 MB
After opening and closing 8 items 2526 MB

That's 25 MB for every still scrolled past, all of it heap.

The change. blitz-dom's image decode (both decoder paths in net.rs) now fits a picture to the box its URL's query asks: raea-w=N and/or raea-h=N.

  • The picture keeps its shape and is never scaled up.
  • Scaling is area-averaged (thumbnail), on premultiplied pixels when any pixel is see-through.
  • Every server already ignores the query: the app's node server returned the same bytes with and without it, and raea-page's file loads read url.path(). A browser ignores it too.

The feed's cards ask for their pictures at the card's size in a raea-feed PR that goes with this one.

Tests. Unit test a_picture_fits_the_size_its_url_asks: the asked width, the tighter of a width and a height, never upscaled, an unknown key ignored, and no colour bleeding from transparent pixels.

🤖 Generated with Claude Code

…-w, raea-h)

A feed card drew a 2560x1440 still at 720 points at most, and raea's window held it decoded at full size: 14.7 MB
of RGBA a still, and the window grew 25 MB for every still scrolled past (raea-feed e2e/memory.spec.ts: 1.1 GB open,
2.0 GB after 60 stills, 2.5 GB after opening a few). blitz-dom's image decode now fits a picture whose URL's query
asks raea-w=N and/or raea-h=N to that box, its shape kept and never larger, area-averaged on premultiplied pixels
when any is see-through. The servers ignore the query (the app's node server returned the same bytes; raea-page's
file loads read url.path()), and so does a browser. The feed's cards ask theirs at the card's size.
…in's :has() clause and this lane's picture fit)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shinyobjectz added a commit that referenced this pull request Nov 18, 2026
…he page's code handed over once

raea's page host kept the last 240 frames' UI trees (tree.rs TREES) for the MCP ui tool. It did that in the person's
app too, where the MCP server is off and nothing reads them: 315 MB of serde_json trees with a feed of 120 cards open,
found by MallocStackLogging in raea-feed's e2e/memory.spec.ts (MEM_STACKS).

- The trees are kept only once the MCP server serves (tree::KEEP, set by mcp::serve). LATEST, which BRP's ui method
  reads, is kept as before.
- The frames the MCP reader was handed already (tree::SEEN) are let go: its next ask is always for a later frame.
- Frames in a row whose trees are the same are kept once, with their first frame, and handed out as each frame. A page
  at rest is one tree however long it rests, and every reader gets what it got before.

The page host's main also hands the page's code to the mount once instead of keeping it for the app's whole life: the
feed's bundle is 21 to 26 MB.

raea-feed's memory spec, 60 stills of 2560x1440, with raea #184 and raea-feed #97:

| Stage | 0.1.8-rc3 | Now |
|---|---|---|
| Feed open | 1131 MB | 757 MB |
| End of feed | 2032 MB | 904 MB |
| After opening items | 2526 MB | 1317 MB |

Unit tests (tree::tests) cover:
- a run handed out frame by frame;
- what was handed out let go;
- a run part-way through kept;
- the 240 cap.
shinyobjectz added a commit that referenced this pull request Nov 18, 2026
…he page's code handed over once

raea's page host kept the last 240 frames' UI trees (tree.rs TREES) for the MCP ui tool. It did that in the person's
app too, where the MCP server is off and nothing reads them: 315 MB of serde_json trees with a feed of 120 cards open,
found by MallocStackLogging in raea-feed's e2e/memory.spec.ts (MEM_STACKS).

- The trees are kept only once the MCP server serves (tree::KEEP, set by mcp::serve). LATEST, which BRP's ui method
  reads, is kept as before.
- The frames the MCP reader was handed already (tree::SEEN) are let go: its next ask is always for a later frame.
- Frames in a row whose trees are the same are kept once, with their first frame, and handed out as each frame. A page
  at rest is one tree however long it rests, and every reader gets what it got before.

The page host's main also hands the page's code to the mount once instead of keeping it for the app's whole life: the
feed's bundle is 21 to 26 MB.

raea-feed's memory spec, 60 stills of 2560x1440, with raea #184 and raea-feed #97:

| Stage | 0.1.8-rc3 | Now |
|---|---|---|
| Feed open | 1131 MB | 757 MB |
| End of feed | 2032 MB | 904 MB |
| After opening items | 2526 MB | 1317 MB |

Unit tests (tree::tests) cover:
- a run handed out frame by frame;
- what was handed out let go;
- a run part-way through kept;
- the 240 cap.
@shinyobjectz
shinyobjectz merged commit 08d0c77 into main Nov 18, 2026
4 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.

1 participant