perf(context): Optimize subsystem prefix routing - #169
Conversation
Build a normalized inventory index and resolve subsystem paths through binary-searched component ranges. Reuse shared route scoring, preserve deterministic path order and case-insensitive top-K behavior, and cover duplicate prefixes and boundaries.
|
Reviewed at Behavior is identical to main. Built binaries from
The case-insensitive path preserves emission order. This is the subtle part:
On the red CIBoth failing legs are in packages this diff cannot reach, and
Locally on this branch: Two leftovers I'm still not blocking on: the redundant early duplicate check at Merging. Nice result on the benchmark, and thanks for taking the reuse half of the note as seriously as the perf half. Generated by Claude Code |
perf(context): Optimize subsystem prefix routing
What does this PR do?
matchSubsystemRoutesfor context routing, keeping scoring, ordering, and top-K selection in one place.This reduces subsystem routing work without changing its matching or confidence semantics.
Type of change
Checklist
go test ./...-race.go vet ./....Additional notes
Routing remains inventory-only, bounded, deterministic, and free of semantic search or unbounded expansion.
On a stress fixture with 40 matched subsystems, five prefixes each, and 20,000 files, the sorted-range resolver measured 4.3 ms versus 14.1 ms for the previous prefix-map implementation (~3.3× faster), with 61% fewer allocated bytes and 80% fewer allocations.