Skip to content

feat: bulk-load documents from the mirror bundle with prefetch - #11

Merged
m1ngsama merged 2 commits into
mainfrom
feat/bundle-prefetch
Sep 26, 2026
Merged

m1ngsama merged 2 commits into
mainfrom
feat/bundle-prefetch

Conversation

@m1ngsama

Copy link
Copy Markdown
Member

A cold search reads every document one request at a time: 248 requests and 43 s with 1 s of latency per request.

  • prefetch() fetches ${mirror}/bundle.json once and stores every entry whose sha matches the current tree and whose content hashes to that sha, so a stale or tampered bundle can't poison the cache. It returns how many were loaded, and 0 without a mirror or bundle.
  • search() prefetches when more than 6 candidates are uncached. With 1 s of latency a cold search drops to 2.2 s and 2 requests.
  • The bundle has its own 30 s timeout and never trips the mirror breaker, so losing it only means per-file mirror reads. clear() now also resets the breaker.
  • The in-memory file cache holds 1000 entries instead of 200, so a prefetched library isn't evicted. Additive; ships as 0.3.4.

@m1ngsama
m1ngsama merged commit 2cd7407 into main Sep 26, 2026
5 checks passed
@m1ngsama
m1ngsama deleted the feat/bundle-prefetch branch September 26, 2026 16:25
@m1ngsama m1ngsama mentioned this pull request Sep 26, 2026
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