Repository navigation
Conversation
A common bare name brings the same candidate definitions back on every call site, but the bare-name binding pass recomputed facts that depend only on a candidate's source file once per candidate per call: - the Go import path of every candidate of an imported selector call, which re-walked the directory ancestors probing for go.mod because the module cache only remembered directories that own one; - the language family of every candidate for the cross-language guard; - in the shared disambiguate_ambiguous_candidates tie-breaker, the test-path classification of every candidate, plus a set of the test candidates rebuilt for each element (quadratic per call). The pass now memoizes the family and Go import path per source file for the duration of one extract() call (the family honours .graphifyrc suffix overrides, so the memo never outlives the pass), and the Go package repoint below it shares the same memo. _go_import_path_for_file caches every directory a walk visits with the walk's answer, so sibling packages stop at the first known directory; a go.mod without a module line still stops the walk with no import path. The tie-breaker partitions candidates in one pass, keeping their order, and classifies each distinct path once through a bounded memo. Output is unchanged: graph.json, the partition cache and GRAPH_REPORT.md are byte-identical to the previous code on cold builds of a large Go monorepo and a Python web framework, and on an incremental Go rebuild. Fixes Graphify-Labs#5666 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks for the pull request, @Max17190. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.11 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify review 
No issues reported · High impact
The change memoizes source-file language and Go import-path facts during call binding, and caches Go module-walk results for visited directories.
Code graph · 7825 functions depend on this change
- 1 function became more coupled.
extract()(1454 callers). - 535 of 666 test files are affected by this change.
- Gate, test list and every flagged function: in the Graphify check.
Reviewed d41ef02
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Call binding recomputed facts about each candidate's file on every call. The Go import path lookup walked the ancestors for
go.modeach time, the language family was derived again, and the tie breaker rebuiltset(test_cands)for each element. A cold Kubernetes build took 21 minutes. Fixes #5666.Summary
_go_import_path_for_filenow caches every directory it walks with that walk's result.extract()stores each file's language family and Go import path for the rest of the pass. The tie breaker splits candidates in one pass and caches the test path check per path.graphify update .Each number is the median of 3 runs on a 16 vCPU Linux machine with CPython 3.12. The output matches v8 byte for byte.
Limitations: repositories without Go or with few ambiguous names barely change, and incremental Go updates are not faster.
Test plan