Repository navigation
Merge export * tables without per-name collision trackers - #64722
Draft
Gavin Kline (gwkline) wants to merge 1 commit into
Draft
Gavin Kline (gwkline) wants to merge 1 commit into
Gavin Kline (gwkline) wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The optimization changes core recursive module-export resolution and warrants final human validation despite strong regression coverage.
0 open findings
What changed in this PR
Optimizes compiler resolution of export * tables while preserving collision and type-only export semantics.
Changes:
- Merges re-export tables directly with preallocated capacity.
- Defers collision tracking and diagnostic text creation.
- Adds comprehensive compiler regression coverage and baselines.
| File | Description |
|---|---|
tsc/internal/checker/checker.go |
Optimizes export-table merging and collision tracking. |
tsc/testdata/tests/cases/compiler/exportStarNameCollisions.ts |
Adds export-star collision scenarios. |
tsc/testdata/baselines/reference/compiler/exportStarNameCollisions.errors.txt |
Captures expected diagnostics. |
tsc/testdata/baselines/reference/compiler/exportStarNameCollisions.js |
Captures emit and declarations. |
tsc/testdata/baselines/reference/compiler/exportStarNameCollisions.symbols |
Captures resolved symbols. |
tsc/testdata/baselines/reference/compiler/exportStarNameCollisions.types |
Captures inferred types. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Author
|
@microsoft-github-policy-service agree |
Gavin Kline (gwkline)
force-pushed
the
perf/export-star-tables
branch
from
October 10, 2026 21:39
f405731 to
3414ad3
Compare
This was referenced Oct 20, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Gavin Kline (gwkline)
force-pushed
the
perf/export-star-tables
branch
from
October 20, 2026 16:36
3414ad3 to
cc33658
Compare
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.
Fixes #64719
Analysis
See #64719. For each module with
export *,getExportsOfModuleWorkermerged every re-exported table into a scratch table, allocating anExportCollisionrecord (with the module specifier text) for every distinct re-exported name so it could report TS2308 later. It then walked that table again to find collisions and merged the scratch table into the result. It also copied every visited module's export names into a set that only mattered when anexport type *was present.So every
export *layer cost several allocations per re-exported name, even with a singleexport *, where nothing can collide. Barrels over large modules (generated clients, ordate-fns- and AWS-SDK-style entry points) pay this at every layer. The generator in the issue spends most of its check time here.Fix
export *: a map from each re-exported name to the declaration that first contributed it. A later declaration that contributes a different symbol under that name is reported against the first one as it is merged. The module's own exports are in the table before anyexport *and never in that map, so re-exporting one of them is still not an error.typeOnlyExportStarMaponly when that map exists.ExportCollision,ExportCollisionTableandextendExportSymbolshad no other users and are removed.Semantics
Unchanged. The first contributing
export *still wins. A module's own exports still shadow re-exports without an error.defaultis skipped,export=is never reported as TS2308, and theexport type */export *override rules are the same. Diagnostics used to be emitted in map order and are now emitted in declaration order; they are sorted before output either way.New test
exportStarNameCollisionscovers:export *export type *on either sideIts baselines were generated with the old code and are unchanged. No existing baseline changes.
Results
M3 Pro, medians of alternating runs:
The monorepo number is a 3% median improvement over eight runs, but run-to-run noise on that program is about ±10%, so treat it as "no regression" rather than a measured win. The generator result is stable across runs.
The profiling, the patch and this description were produced with Claude Code (Claude Fable 5.1 and Claude Opus 5.5). I have read and understand the change and will handle review myself.
Copilot Checklist
I successfully ran the applicable command at the end of my session, and it completed without error:
🤖 Generated with Claude Code