Repository navigation
perf(registry): reduce scan allocation and duplicate evidence work - #1341
Gajesh2007 wants to merge 2 commits into
Conversation
Reuse bounded private candidate storage, retain compact detached evidence, borrow forecast inputs, project alternates once, and aggregate pending/service evidence. Preserve public quote ownership and locked reservation admission/debits. Include differential/lifetime/boundary tests and measured local validation.
|
@Gajesh2007 is attempting to deploy a commit to the EigenLabs Team on Vercel. A member of the Team first needs to authorize it. |
Threat model review — advisoryReviewed head Review not completed for this head. Previous findings are superseded, not confirmed resolved. Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging. Coverage: 0/0 source units; cross-file integration pending. 0 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned. Cost this run: $0.0000 reported, $0.0000 reserved with unknown cost; 0 paid request(s), 0 reused batch(es), 0 provider cache-hit tokens. Saved findings and earlier report · Historical findings are not confirmed resolved. |
Remove unused routingSnapshot decode and shadow-TTFT wrappers after compact candidate snapshots took over their callers. Preserve live admission and shadow behavior; update comments and measurement provenance. Validated full registry race suite, coordinator vet, macOS and Linux builds, docs impact and docs lint.
|
Superseded by #1345 at the author's request. The head branch now lives in Layr-Labs/d-inference (codex/registry-hot-path-optimization), not the personal fork. Both signed cleanup histories are preserved, including f3233be, and current master bc1ee16 is merged. Independent correctness/structure reviews, full coordinator tests, registry race tests, lint, native/Linux builds, and docs checks passed. Exact-head CI continues on #1345. The personal branch is preserved. |
Fleet reservation scans retain full admission snapshots, repeatedly copy forecast evidence, and repeat pending/service and alternate projections. This reduces that work through bounded private storage reuse, compact detached candidates, borrowed immutable inputs, one pending/service projection per locked snapshot, and one alternate selection projection. The locked current-state admission and pending debit remain atomic.
All five optimization areas are implemented and measured together. Candidates fall from 1,448 to 592 bytes. Public/decorated preparations retain owned storage; private reuse starts only after copying the model index and ends after copied decisions/plans are assembled. Indexed scans above 3,520 providers use owned storage immediately; retained objects are limited to 64 chunks (approximately 2 MiB per object, without a global pool cap).
Six alternating fresh-process pairs (Go 1.25.0, 700 ms/case, 12 workers) improve all 23 measured workloads in every paired round against master. The standard 350-provider reserve goes 313.661 → 267.959 µs (-14.57%), with 435,152 → 8,370 B/op (-98.08%) and 19 → 6 allocations. Unique-ID parallel improves 23.36%, writer-loaded parallel 26.29%, eight-alternate planning 19.51%, and busy pending/service cases 24.03–29.84%. Scale and skew cases improve 14.75–25.11%; capacity preflight improves 7.36%.
A separate fair three-variant block shows 337.538 → 269.058 µs versus master (-20.29%), while optimized routing remains 24.32% slower than the older pre-#1324 revision (216.425 µs). Results are per-block medians, not summed prototype gains. The selected oversized fallback avoids a measured 1.73% mixed narrow/large scan slowdown from always borrowing; allocation and latency tradeoffs are documented.
Before
After
Blue marks incoming work, amber/indigo scan work, green the preserved admission/debit and returned values, and red the existing failure policy. Return/reset follows synchronous consumption; public scans and decorated preparations never borrow private candidate storage. A later dispatch-plan claim uses copied evidence and current locked revalidation.
Validation
Cached pinned Go 1.25.0, isolated checkout, offline modules and empty database environment:
python3 scripts/run-coordinator-tests.py --jobs 2: all 21 jobs pass; 91 tested packages, 4,298 top-level passes, 111 top-level skips; 114.405 seconds.go test -race ./coordinator/tests/registry/... -count=1 -v: eight packages pass, 1,512 top-level passes, no race report.go vet ./coordinator/...,make coordinator-build coordinator-build-linux, andpython3 scripts/test-coordinator-tests.py: pass.make docs-impact-check BASE=origin/masterandmake docs-check: pass; impact coverage complete and 331 documents lint clean.The required dedicated refactor subagent removed the obsolete private preparation wrapper chain; focused race checks and final combined checks passed afterward. A separate independent correctness reviewer found no actionable introduced defect in the final coordinator diff. No HTTP/protocol/config/migration/ledger changes.
The full local suite skips PostgreSQL cases without an installed database and credentials-dependent/provider E2E was not run. The default host Go 1.27.1 has existing JSON parity failures on both original head/base; acceptance uses pinned Go 1.25.0. Local microbenchmarks do not predict production first-content or inference latency. Parallel ns/op is aggregate throughput, not per-request latency; writer maxima are noisy. Normal exact-head CI, automated review and protected E2E gates remain required before merge.
Canonical mechanism docs and the full combined measurements are in the measurement report.
Both PR commits are GitHub Verified (
valid), published through GitHub's signed commit API. Initial implementation122b5eed47d605c0cce09cd2b45c8239df32229chas reviewed masterc5552d3af7ae725f956a2911b44d3e933da4b94cas its sole parent. Latest headf3233beca292dc6385148623a75a3bc6b4c3b8e5removes four unused legacy snapshot helpers found by CI and updates stale comments; active decode-floor, live TTFT and shadow paths are unchanged. An independent reviewer approved the cleanup. Post-cleanup full registry race checks pass across eight packages (1,513 top-level tests), along with coordinator vet, macOS/Linux builds and docs checks. Latest remote tree586f2b3b4300500403c7e507c417eb5944ca8cc8exactly matches the locally validated tree. Timing samples preceded this behavior-preserving deletion; exact latest-head CI and integration remain separate merge gates.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.