-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FindModuleCache: leverage BuildSourceSet
On large codebases, the time in `load_graph` is dominated by `find_module` because this operation is itself `O(n)` where `n` is the number of input files, which ends up being `O(n**2)` because it is called for every import statement in the codebase. Introduce a fast path that leverages the fact that for imports within the code being typechecked, we already have a mapping of module import path to file path in `BuildSourceSet` In a real-world codebase with ~13k files split across dozens of disjoint folders, this brings `load_graph` from ~180s down to ~48s, with profiling showing that `parse` is now taking the vast majority of the time, as expected.
- Loading branch information
Showing
2 changed files
with
100 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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