Finding
Code-rank repeatedly performs target membership checks and canonical path work during a single ranking run. These operations are safe to cache per run and can become significant on larger TypeScript projects.
Proposed approach
- Replace repeated target-array membership checks with a
Set in packages/nav/src/service.ts.
- Cache canonicalized paths for the duration of one rank operation in
packages/nav/src/code-rank/rank.ts.
- Add a representative code-rank benchmark and focused correctness coverage for path aliases/canonicalization.
- Keep the optimization scoped to a single run. Do not persist or reuse the language service while scripts use a fixed version of
"0", because that would permit stale program state.
Acceptance criteria
- Ranking output and tie behavior remain unchanged.
- Target membership is constant-time after setup.
- Each distinct path is canonicalized at most once per ranking run.
- Symlink/case-normalization behavior remains correct on supported platforms.
- A benchmark demonstrates the effect on a multi-file fixture.
- Full nav and workspace validation passes.
Finding
Code-rank repeatedly performs target membership checks and canonical path work during a single ranking run. These operations are safe to cache per run and can become significant on larger TypeScript projects.
Proposed approach
Setinpackages/nav/src/service.ts.packages/nav/src/code-rank/rank.ts."0", because that would permit stale program state.Acceptance criteria