`InMemoryStore.search` built an `(item, vectors)` pair for every item in
every matching namespace, then kept `candidates[offset:offset + limit]`.
A `limit=10` search on a 10,000-item namespace took 1.9 ms, nearly all
of it building candidates the slice then dropped. Paging a namespace 100
items at a time, as deepagents' `StoreBackend` does for `ls`, `glob` and
`grep`, rebuilt the whole listing for every page.
Without a filter, and without a query the store can embed, the result is
exactly that slice, so `_filter_items` now stops once it has `offset +
limit` matches. The namespace prefix test also becomes one tuple
compare: a namespace shorter than the prefix slices to itself, so it can
never equal the prefix.
Median of four alternating rounds on main and on this branch, Python
3.14:
| workload | main | this PR | speedup |
|---|---|---|---|
| `search(ns, limit=10)` on a 1,000-item namespace | 70 µs | 4 µs | 17x
|
| same, 10,000 items | 1.92 ms | 4 µs | about 490x |
| graph node that searches 1,000 memories (`limit=5`) and adds one, 20
steps | 3.41 ms | 1.86 ms | 1.83x |
| same, 10,000 memories | 39.4 ms | 1.83 ms | 21.5x |
| paging 5,000 items 100 at a time | 47.1 ms | 30.1 ms | 1.57x |
| `search` over 10,000 one-item namespaces | 23.4 ms | 15.5 ms | 1.51x |
| `search` with a filter, `get`, `put` | | | about 1x |
A filter keeps the full scan, so a filter that raises on some item (a
range operator on a missing key) still raises the same way. Negative
`offset` or `limit` keep it too, since a slice counts those from the
end.
## Test plan
- [x] `test_search_pages_match_full_listing` pages plain and filtered
searches across nested and look-alike namespaces and compares each page
with the full listing. It passes on main too, since the results are
unchanged.