perf(reader): create PDF page canvases on first render
vomebook
40b94bf
Every PDF page shell created a default 300x150 canvas at mount. A 234-page
original PDF therefore held 234 blank backing stores (~16.7M pixels, ~67 MB)
before any page was visible, and the count scaled with the document.
Create the canvas in the renderer instead, matching the v3 path. Measured on a
production 234-page PDF: 234 canvases / 16.7M px at open -> 0 / 0, with the same
pages rendered as they scroll into view.
- PDF-pages/image-pages images stay transparent until decoded, then appear whole;
a blank visible page fades in (120 ms), offscreen pages and swaps switch at once.
- Before the primary PDF is ready, opening range reads yield to visible page images
(admitPdfRange: 1 / 4 / 6 in flight) and nearby pages' images start 1 s after the
first one shows; visible demand wakes pending hybrid polls.
- Read-aloud text discovery reads only pages the renderer has extracted or is
extracting. The previous probe extracted up to 12 unrendered pages, which for a
scanned PDF downloads their full page images ahead of the visible page.
- Tests: scroll-scheduling/range-transport cases, hybrid reveal/lookahead cases, a
read-aloud probe regression, the Pages full-search rule and a drawer-transition
race in the dark-theme handoff test.
fix(reader): PDF.js for large hybrid books, prioritized image fallback, stable page geometry, hybrid outline
vomebook
ba00b90
- Range-transport PDFs up to 1 GiB (complete bodies keep 512 MiB) on client and proxy
- A failed primary leaves hybrid mode; image pages use a priority-ordered pool with preemption
- Visible-page image fallback waits for this book's measured PDF draw time
- Image and canvas geometry changes preserve the reading anchor; first geometry seeds shells
- PDF outline fills a missing manifest TOC after the first page
perf(reader): prioritize hybrid PDF over speculative streams
vomebook
be18ab1
perf: overlap PDF tail and v3 preview reads; fix selection jumps
vomebook
e9506ad
Native PDFs: PDF.js parses non-linearized files from the end, demanding
the trailer and cross-reference chunks one round trip at a time. Fetch the
last two aligned chunks once alongside startup and serve those demands from
it. Paired production A/B (24 cold opens): first canvas 680 ms faster at
the median, 22/24 pairs faster, one fewer range request, same bytes.
v3 PDFs: fetch the opening preview partition alongside the page map; it
depends only on the validated reading manifest. Paired A/B (58 cold opens):
229 ms faster at the median, 39/58 pairs faster, no duplicate requests.
Selection: a focus on a separator text node (line ends, inter-block gaps)
or on a page whose text layer had not loaded was moved to the last run in
the document, scrolling to a distant retained page. Separator focus is now
left in place, and other focuses are clamped to the nearest run.
refactor: organize project layout and Reader responsibilities