perf(passageRetrieval): fetch each document body once per search, not once per hit
searchPassages pulled the whole document row for every hit and then sliced ~1.6 KB out of it. With perDocCap 24 over a 330 KB merger agreement that is the same body fetched 24 times - roughly 16 MB allocated per query to keep 77 KB. Measured: a 776-query profile exhausted a 2 GB heap partway through. Memoized per call (pure; the cache dies with the call, so nothing goes stale). Measured on the Stage 18 four-arm sweep over 776 tests: 13m -> 4m06s, a 3.2x speedup, with the receipt byte-identical (sha b5ab5a94e25df7cab7d80502bf750475b1ff443b21ea174608a2e8d0e19fd8cb before and after) - no retrieved span, ordering or score changed. This is the product retrieval path, not just the experiment harness, so it lands on the laptop-CPU inference target too. 17 passageRetrieval tests pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H9ToHYJVDxfeJcJwdzrP2H
| Repository | eliziff/Beaver |
|---|---|
| Author | Eli Ziff <eliasziff@gmail.com> |
| Authored | |
| Parents | c8baf66c |
| Stats | 1 file changed , +19 , -2 |
| Part of | Legal grounding and retrieval research |
Capture this commit into my fork
Download a Markdown prompt that tells Claude how to port this
exact commit into your working tree. Run it via
claude -p < capture-commit-17884220.md
from inside the repo you want the change in.