Skip to content

Reduce large-library row and highlight preparation work - #352

Merged
callumalpass merged 2 commits into
mainfrom
reader-sw-library-performance-audit
Nov 28, 2026
Merged

callumalpass merged 2 commits into
mainfrom
reader-sw-library-performance-audit

Conversation

@callumalpass

Copy link
Copy Markdown
Member

Refs #248

Progressive source loads now publish the first available rows immediately and batch subsequent snapshots by growth, including the first 1,000 rows on tiny pages. Standalone sources skip the parts graph. Filtering builds a parent-title index only when a matching clause needs it. Note and annotation search results are narrowed before sorting. Collection highlight headings index their owners once and preserve first-match semantics.

Synthetic measurements on the rpnpm builder, Node 22.22.0, median of seven runs after one warm-up. Run rpnpm --filter @mdbase-reader/app bench:library. The fixture starts with decoded 128-row pages, uses the production row-preparation functions on progress and completion, and supplies one highlight per source. Times exclude SDK I/O, DOM and paint.

Operation 1,000 sources, before → after 10,000 sources, before → after
Progressive hydration and ordered rows 5.76 → 2.30 ms 91.56 → 43.65 ms
Filtered rows (10% match) 0.68 → 0.50 ms 5.19 → 2.29 ms
Collection highlight headings 5.87 → 2.85 ms 531.00 → 12.40 ms

A separate Chromium run with the Reader app fixture mounted 27 source rows and 11 highlight cards at both sizes. Search returned the expected 100 and 1,000 sources with 27 mounted rows. For a 1,000-source library arriving one row per page, cumulative intermediate snapshot copies fell from 500,500 to 4,402 source references.

Shell investigation. A fresh Chromium profile on Reader production at 6147440abe50 reproduced two online worker failures. Pages redirects /index.html and /404.html with 308s. Both clean URLs served the manifest hashes, the SDK 0.2.58 worker controlled the page with 229 cached entries, and the sample library reopened offline with HTTP 200 and zero page errors. Reader ships the original SDK runtime. The Pages browser audit now rejects unexpected same-origin online request failures, with a unit test for its two allowed redirect probes. The local production build passed this audit as well.

No open Reader issues were listed at triage.

@callumalpass
callumalpass merged commit d94b99a into main Nov 28, 2026
3 checks passed
@callumalpass
callumalpass deleted the reader-sw-library-performance-audit branch November 28, 2026 05:57
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