Files
codegraph/__tests__
luojiyinandClaude Opus 5.5 0174f804c3 perf(resolution): read a bare JS/TS call's local binding once per match — graph byte-identical
matchByExactName asked isLocallyBoundJsName for every cross-file
candidate of a bare JavaScript or TypeScript call, though the answer
depends only on the reference's name and file, which are the same for
every candidate. The helper memoizes it per file and name, but each
call still built the key and read the memo. The answer is now kept in
a lazy local for the one match, at the same place in the filter, so
candidates, order, scoring and confidence are untouched.

Validation: fresh indexes of codegraph's own source, excalidraw, vben,
express and zod dump byte-identical to main's (nodes, edges with their
metadata, unresolved refs, files), and express stays identical through
sync after a JS file is added, edited and deleted. A CPU profile of
indexing codegraph's own source (all threads, two runs per side) puts
isLocallyBoundJsName's self time at 150-173 ms on main and 45-46 ms
here; the scans it guards (bindsAtSites) are unchanged. Whole-index CPU
on vben, 10 interleaved runs, moves less than its noise. The PR's 8
tests pin the matcher's behaviour and pass here and on main.

Original PR #2871 by @luojiyin1987.
Fixes #2870

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 18:32:43 +00:00
..