Skip to content

Name resolution: a package's imported names are looked up, not collected into one table - #1451

Merged
Frotty merged 2 commits into
masterfrom
claude/package-name-lookup
Oct 13, 2026
Merged

Frotty merged 2 commits into
masterfrom
claude/package-name-lookup

Conversation

@Frotty

@Frotty Frotty commented Oct 13, 2026

Copy link
Copy Markdown
Member

The names a package can see through its imports were one Guava ImmutableSetMultimap per 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.putAll and build).

A lookup asks for one name, so NameResolution.scopeNameLinks/scopeTypeLinks ask each import of a package for it instead (NameLinks.importedNameLinks, TypeNameLinks.importedTypeLinks): in the order of the imports, skipping NoWurst and unresolved imports, keeping the first of equal links, which is what get on 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.

…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).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T09:07:14.331511Z 808e8ef Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Frotty

Frotty commented Oct 13, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 808e8efcc3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@Frotty
Frotty merged commit cbe670c into master Oct 13, 2026
2 checks passed
@Frotty
Frotty deleted the claude/package-name-lookup branch October 13, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant