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
Localize TypeScript Imports #10442
Comments
Related: #8613 Note that working on this issue may also help break down large output.d.ts files by moving definitions out somewhere else and re-importing them, what 8613 implies. However, it is likely that to actually speed up TypeScript compilation we need to ensure that whether the files are small or large, there is a smaller number of definitions consulted during compilation. Essentially |
@RobbieMcKinstry I've published an utility that might help here https://github.com/t0yv0/tsc-resolution-tracker |
Consider modifying TypeScript provider code generation to optimize for the number of definitions that TypeScript compiler needs to process during compilation of simple Pulumi programs that use resource providers.
Issue details
For a motivating example consider that ~13s is spent compiling TypeScript on a simple program that references an S3 Bucket. This is compared to ~2s spent on a program that does not reference any resources. Note how the compiler needs to process 1101447 lines of definitions vs 10 lines of TypeScript.
Current source code:
Optimizing the imports in this program gives:
However, TypeScript compilation remains just as slow. Digging deeper, it appears that
bucket.d.ts
makes these references:There is a way to debug loading of the .d.ts files
tsc --traceResolution
. It appears that the entire AWS set of definitions is imported. Judicious optimizations here can help ensure that a smaller set is imported; for example only S3 definitions.Affected area/feature
Node codegen.
The text was updated successfully, but these errors were encountered: