Files
ai-app/app/androidApp/src/main/kotlin/com/example/aiapp
irisandClaude Fable 5 a63ae8347f Load history before the reader arrives, and estimate room from real sizes
The first loading boundary sat barely off-screen: the opening page is
deliberately small (sized for time-to-first-frame), so one short scroll
met a spinner and a round trip. And the prefetch that should have
hidden every later boundary estimated room-ahead from the average size
of the units currently visible -- the worst possible sample, since two
tall blocks filling a viewport multiply out over dozens of unseen
one-line rows and report screens of room when the end is one swipe
away. Iris's report showed exactly that: viewport 676px, two units
visible.

Three changes, one per cause:

- The opening page is followed by a full page fetched in the
  background as soon as the screen is up -- the same reasoning that
  keeps the opening page off the critical path puts the first real
  page right behind it. A restore skips this; it just paged as deep as
  its anchor needed.
- Room ahead is now added up from the real size of every unit the list
  has ever laid out, recorded by key as units pass through the
  viewport, with the running average standing in for units never seen.
  The walk early-outs at the cushion, so a frame's check stops after a
  few units in the common case.
- The cushion is six screens (was three) and a page is 400 events
  (was 800). The cushion grew because firing early costs a page nobody
  may read while firing late is a spinner under a finger for a tunnel
  round trip; the page shrank because pages now load before anybody
  waits on them, so a page only has to stay above the fold floor --
  the median run of deltas folding into one reply is ~400 events, and
  below that a page can add no visible room at all. Smaller pages
  cross the tunnel faster and land in smaller frame spikes, which is
  what makes the boundary hard to catch.

Verified on the emulator against the biggest transcript on the
machine at --delay 300: opening a session loads the first background
page unscrolled, twenty-five hard flings paged the rest in with zero
frames in which the spinner was on screen, and at --delay 2000 --
outrunning the chain deliberately -- the boundary shows the spinner
and then heals with the paragraph being read holding its position.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-31 15:04:04 -04:00
..
2026-08-29 13:46:34 -04:00