Repository navigation
perf(tsrx): speed up local export scope lookups - #7
Merged
Merged
Conversation
|
@jonkwheeler is attempting to deploy a commit to the Ripple Team Team on Vercel. A member of the Team first needs to authorize it. |
trueadm
approved these changes
Aug 27, 2026
This was referenced Aug 27, 2026
1 task done
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.
Summary
Modules with many named local exports no longer rescan every declaration for every exported name. Parser behavior remains unchanged while local export validation now scales linearly with the number of declarations and exports.
Performance
The benchmark parses a module with 6,000
constdeclarations and one export list containing all 6,000 names. Each result is the median of five runs with the same semantic digest.Validation
tsgo --noEmit -p packages/tsrx/tsconfig.jsonpassedgit diff --checkpassedThis is an internal parser performance change with no public API, compiler-output, dependency, or changeset impact.
Note
Low Risk
Internal parser caching in export validation only; behavior is covered by new regression tests and existing suites, with no public API change.
Overview
Speeds up named
export { … }validation when a module has many local bindings and export lists, without changing parse results or diagnostics.checkLocalExportin the TSRX parser no longer scans each scope’s fulllexical/vararrays on every exported identifier. It keeps a per-scope incremental cache (WeakMap→Setof names plus array lengths) and only merges new entries when those arrays grow, so work scales with declarations plus exports instead of exports × declarations.Regression tests cover late declarations (e.g.
export { first }thenconst secondthenexport { second }) and unchanged errors for undefined exports.Reviewed by Cursor Bugbot for commit b9c65e1. Bugbot is set up for automated code reviews on this repo. Configure here.