Repository navigation
Name resolution: a package's imported names are looked up, not collected into one table - #1451
Merged
Merged
Conversation
…ted into one table The names a package can see through its imports were one table per package (attrNameLinks of the package), holding every name each import exports. Built for every package, that grows with the packages times the names they import; on a large map it was about a quarter of the type check. A lookup asks for one name, so it asks each import for it instead, in the order of the imports, keeping the first of equal links as the table did. Other users of the table (completion, the REPL) still build it. A large map: type check samples about 5660 to 4750 (-16 %), build 49.9 to 47.9 s (medians of 3). Output identical; the old table and the new lookup were compared on every lookup of that build (691434 lookups).
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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 names a package can see through its imports were one Guava
ImmutableSetMultimapper package (WPackage.attrNameLinks,NameLinks.calculate(WPackage)), holding every name each import exports; the same for type names. Built for every package, that grows with the packages times the names they import: on a large map with many packages exporting thousands of names (object data, the stdlib), building it was about a quarter of the type check (ImmutableSetMultimap$Builder.putAllandbuild).A lookup asks for one name, so
NameResolution.scopeNameLinks/scopeTypeLinksask each import of a package for it instead (NameLinks.importedNameLinks,TypeNameLinks.importedTypeLinks): in the order of the imports, skippingNoWurstand unresolved imports, keeping the first of equal links, which is whatgeton the table returned. The REPL, which sees all names, keeps the table. Other users of the table (completion) still build it when they ask for it.A large map (Jass): type check samples about 5660 to 4750 (-16 %), build 49.9 to 47.9 s (medians of 3 alternating builds). Jass output and object data identical. The table and the lookup were compared on every package lookup of that build (691434 lookups, content and order): no difference.
No behaviour change, so no new test. Run locally: PackageTests, ConfigPackageTests, CompletionCommentsTests, CompletionDocumentationTests, LspNativeFeaturesTests, ClassesTests, InterfaceTests, ModuleTests, GenericsTests, GenericsWithTypeclassesTests, TypeClassTests, NewFeatureTests, BugTests, ModelManagerTests, ClosureTests, EnumTests, StdLibOwnTests.