Repository navigation
impact: walk the import closure back from the reached modules, not over the whole project (#1033) - #1786
Merged
Conversation
…er the whole project (#1033) imports_file was the transitive closure of every file's imports, built by joining the relation to itself on every query whatever was asked. Only import_hop reads it, and only for the files of modules the change reaches. It is now seeded from those files and walked back linearly, which derives the same pairs. On a 3.6k-file TypeScript project the closure was 1.2M rows and 27 s of the solve; impact goes from 61-85 s to 4-17 s over seven targets, with identical JSON answers. A new case covers a chain of imports through a cycle, with a control chain that reaches nothing. Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
swapnilpaliwal-sd
requested review from
JaredHLZhang,
Whua689 and
suyashpaliwal26
as code owners
September 29, 2026 06:50
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.
The flat ~40 s floor under every
impacton a large project was one rule:imports_file, the transitive closure of every file's imports, rebuilt on every query by joining the relation to itself, whatever the target. Onlyimport_hopreads it, and only for files of modules the change reaches.imports_fileis now seeded from those files and walked back linearly; it derives the same pairs.typescript/runs-at-import-through-a-chain: a test reaching a module-level call only through a 3-file import chain with a cycle (fails with the recursion removed), plus a control chain that must reach nothing.Checked: on a real 3.6k-file TypeScript project (39.8k symbols, 284k refs), 7 targets (file,
Owner.method, bare name) went from 61–85 s to 4–17 s with identical--jsonanswers; the closure had been 1.2M rows and 27 s of the solve. Control on a real NestJS app: 7/7 identical, time unchanged.Closes #1033
Local: the 5 import cases pass (11/11); the full case suite,
fastpath.py --lang typescriptandquery_rules.pywere still running on the VM when this was opened.