-
Notifications
You must be signed in to change notification settings - Fork 12.8k
[DO NOT REVIEW] Perf testing module-ified TypeScript compiler, take two #50811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This step makes further commits look clearer by unindenting all of the top level namespaces preemptively.
This step makes all implicit namespace accesses explicit, e.g. "Node" turns into "ts.Node".
This step converts each file into an exported module by hoisting the namespace bodies into the global scope and transferring internal markers down onto declarations as needed. The namespaces are reconstructed as "barrel"-style modules, which are identical to the old namespace objects in structure. These reconstructed namespaces are then imported in the newly module-ified files, making existing expressions like "ts." valid.
This step converts as many explicit accesses as possible in favor of direct imports from the modules in which things were declared. This restores the code (as much as possible) back to how it looked originally before the explicitify step, e.g. instead of "ts.Node" and "ts.Symbol", we have just "Node" and "Symbol".
Now that we are modules, there's no reason to ban multiple namespaces per file; each file is its own scope and declaring a namespace won't merge it into any other files.
This project is the same as the (soon added) typescript project.
If these are regular comments, then they won't appear in our d.ts files. But, now we are relying on api-extractor to produce out final merged d.ts files, so they need to be present in the "input" d.ts files, meaning they have to be JSDoc comments. These comments only work today because all of our builds load their TS files from scratch, so they see the actual source files and their non-JSDoc comments. The comments also need to be attached to a declaration, not floating, otherwise they won't be used by api-extractor, so move them if needed.
These appear to break api-extractor, and we won't have a fix until TS starts to emit d.ts files using `import type { ... }` for imports that aren't explicitly written in the source files.
The import expression for the ETW trace types breaks API extractor; it outputs a named import for a non-existent name in the module rather than emitting a default import. For now, redeclare the type locally and then use a conditional type to verify that what we have is compatible with the upstream type when type checking locally.
This configures the existing build tasks to use esbuild by defualt. If using the plain files is desired, passing `--bundle=false` will build using plain files and still produce a runnable system.
Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping @sheetalkamat, @amcasey, @mjbvz, @minestarks for you. Feel free to loop in other consumers/maintainers if necessary |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
@typescript-bot perf test this faster This is the "baseline", i.e. just esbuild on src. |
Heya @jakebailey, I've started to run the abridged perf test suite on this PR at f37e88f. You can monitor the build here. Update: The results are in! |
@jakebailey Here they are:Comparison Report - main..50811
System
Hosts
Scenarios
Developer Information: |
@typescript-bot perf test this faster Now, with |
Heya @jakebailey, I've started to run the abridged perf test suite on this PR at 5c3013d. You can monitor the build here. Update: The results are in! |
@jakebailey Here they are:Comparison Report - main..50811
System
Hosts
Scenarios
Developer Information: |
Closing; I've summarized this on #49332 (comment). |
I can't reopen #50765 due to my rebasing, so I'm opening it again so I can test downleveling of
const/let
.