-
Notifications
You must be signed in to change notification settings - Fork 12.8k
tsc compilation slow on moderate sized project #37635
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
Comments
@rightisleft Thanks for the detailed report! Some initial observations, before I look at your CPU profile:
|
Now that I've looked at your file list, I'd guess there's no reason to use project references, given that you appear to have only two test files (which, presumably, are not enormous?). |
Are the files in |
5: In regards to database/migrations - they are generated by TypeORM. We have 54 migration files. A majority of them are sql code wrapped as strings. |
I've tried excluding both the migrations and test folders... i see about a .5 second increase in complication times. |
Ah, I see what I was missing - 76 types is for an incremental compilation. Can you please try a couple of tests that explicitly defeat that?
|
|
Thanks! Those numbers make a lot more sense. Something's going on with "Program time" - it's nearly always (much) smaller than "Check time". Your files aren't on a network share or something, are they? |
My reading of those numbers is that a lot of time is spent reading the code, but it's not very complicated. TS itself, for example, has roughly 1 type for every 3 lines of code and uses a lot more memory. The cache sizes are also quite small. Is there some way you could exclude the generated files, as an experiment? You might need to insert some casts to |
According to the profile you attached, something like 24% of time is spent in f/l/stat calls (!). Of course, that was for an incremental build, which spends a lot of time on freshness checks, but still... |
1: How would you like me to exclude generated files? |
|
@rightisleft I'm keenly aware that the world is upside down right now, but I thought I'd ping this thread in case it's just fallen through the cracks. |
Please open a new issue and tag me if you'd like to revisit this. |
@amcasey I do have a similar problem but probably due to have large 1 file is. See:
|
@mmahalwy I find that performance tracing is the most effective way to investigate excessive check time. Can you please give that a shot and file a new issue with the results (assuming you don't figure it out yourself from the trace)? |
Uh oh!
There was an error while loading. Please reload this page.
TypeScript Version: 3.9.0-dev.20200326
Search Terms:
tsc slow compilation, tsc memory, tsc slow Program time, tsc Program time
Code
I'm trying to debug why my typescript compiler is taking 9-13 seconds to recompile. This impacts ts-node and development drastically.
typescript version: ^3.X.X
tsconfig.json:
Files: 732
Lines: 364288
Nodes: 1133413
Identifiers: 417612
Symbols: 236577
Types: 76
Instantiations: 0
Memory used: 330244K
Assignability cache size: 0
Identity cache size: 0
Subtype cache size: 0
Strict subtype cache size: 0
I/O Read time: 2.51s
Parse time: 3.77s
ResolveTypeReference time: 0.33s
ResolveModule time: 2.91s
Program time: 9.86s
Bind time: 1.39s
Total time: 11.25s
File List Here: https://pastebin.com/zX7TpM2x
Generated CPU Profile Here: https://gist.github.com/rightisleft/d3c77fe2c643ba4c7832a94209f53ef2
Expected behavior:
This is a mid sized project, it should have a 1-3 second compile time
Actual behavior:
Compile takes anywhere from 9-14 seconds per line change
The text was updated successfully, but these errors were encountered: