Repository navigation
perf(paths): batch canonical lookups with bounded SQL and preserved LRU semantics - #542
Conversation
Review — CS-Macmini PR#542 — head d82ab0aDom: APPROVE med nits Independent, read-only review. Findings
No blockers. No behaviour change beyond the stated purpose was found. Answers to the review points#495 lock rule — no SQL under
Hard upper bound on batching. Yes. LRU semantics identical. Identical for everything observable per request, with the one exception in N1:
Errors in one batch do not poison the cache. Confirmed. A failed query, a Perf claim — reproduced. Measured independently on the merged tree,
The ratios match the PR body; absolute numbers differ slightly (my scalar baseline is faster), consistent with the different Go version. The query-count claim also reproduces: 1,001 transmissions take 3 queries instead of 1,001, and 6 instead of 2,002 on the fallback arm [T]. As the PR body says, MB here is cumulative allocated bytes per op, not peak or retained heap, and stage 2 still holds the decoded in-snapshot paths for up to 500 transmissions at once — I did not measure peak RSS. Overlap with the in-flight paths/store work. No conflict. Behavioural equivalence on real data. I built a baseline server from Tests runAll on the merged tree (
Red-before-green: this PR has no issue, so the acceptance criteria are the PR's own. The new tests cannot compile against master (the helper does not exist), which the author correctly declines to present as behavioural proof — so the binding evidence is mutation, below. M5 is literally master's handler restored, and it is red. My own mutantsSix, run on a private copy of the merged tree;
For N1 I also ran a throwaway probe comparing Repo conventions
Not verified
|
paths: LRU order, NULL pinning tests and per-chunk lruMu (follow-ups to #542)
Summary
Batch both stages of canonical resolved-path lookup for the node Paths endpoint, adapted to this fork's existing immutable observation snapshots and expiring LRU.
Base:
8798f74eeec124f21d0e82a8d64b93b31d7facc0. Three server files only. No schema, config, new persistent cache, dependency or workflow changes. There is overlapping work in #529; synchronize with current master normally before any eventual merge rather than rewriting that branch.Correctness / independent review
Measured performance (local synthetic SQLite, cold LRU)
These are repeated before/after runs on the same fixture, not deployment measurements:
MB values are cumulative allocated bytes per operation, not retained heap, peak memory or RSS. A separate 800-historical-row regression requires fewer than half the scalar allocations and verifies all expected output paths. Temporary storage still scales with valid snapshot observation fanout within the 500-transmission batch; no production peak-memory claim is made.
Scope / limits
Batch-query failures intentionally fall back to the legacy scalar path, so the small query count is not promised during SQL errors. Other endpoints and deferred no-canonical-path confirmation are not universally batched by this change. Local tests use macOS arm64 / Go 1.26.3 and disposable fixtures; Linux PR CI remains separate.
Draft only, auto-merge off; no ready, merge, deployment, GHCR publishing or live-host access.
Post-push Chromium confirmation on the published commit: Nodes list/detail and real neighbor/Paths API contracts pass on a disposable local fixture. Initial PR CI run:
40067050026; no rerun was requested.Source credit / discovery
Adapted from the original contribution by
efiten. This fork lacked the source's earlier batch helper, so both stages were adapted, not blindly cherry-picked: