-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
TypeScript Extremely Slow #21221
Comments
I think there is something else going here.. locally here is what i see: c:\test\21221>tsc --v
Version 2.7.0-dev.20180116
c:\test\21221>tsc --diagnostics
Files: 36
Lines: 72104
Nodes: 292746
Identifiers: 105066
Symbols: 79907
Types: 28453
Memory used: 127961K
I/O read: 0.01s
I/O write: 0.00s
Parse time: 0.85s
Bind time: 0.40s
Check time: 1.68s
Emit time: 0.02s
Total time: 2.95s
c:\test\21221>node c:\releases\2.6.1\tsc.js --v
Version 2.6.1
c:\test\21221>node c:\releases\2.6.1\tsc.js --diagnostics
Files: 36
Lines: 71852
Nodes: 288906
Identifiers: 103737
Symbols: 79674
Types: 28318
Memory used: 129399K
I/O read: 0.02s
I/O write: 0.00s
Parse time: 0.90s
Bind time: 0.45s
Check time: 1.66s
Emit time: 0.02s
Total time: 3.03s This seems like within the margin of error. I think there is something specific about your project that is triggering the slow down, and we would love to know more. Thinking of things that changed between 2.6 and 2.7 is the addition of a new the other is try the same compilation with |
Try to bisect your own code changes and find the commit where it started to be slow, this might help us identify the source of this slowness.. also check if any new |
It is slow now even when we go back in history. We suspected it happened after vscode upgrade, but we're not sure. I can put together a project that reproduces the slowness and share it with you by email if you can take a look. |
sure. email is my github username @microsoft.com |
I have problem creating a repro, when I trim it down it compiles fast. I can't share the whole project, but if I could make a barebone repro I will send it over for you to examine. Does a TS project generally run slower when it has many errors? This is a project we're converting from JS and going through a lot of errors to fix. I'm guessing maybe it gets faster when all errors are resolved? |
if you have errors in the order of 10,000's then yes. creating the error message generates garbage, so generating many of these can generate memory pressure on the GC, and thus more execution time.
One common issue we see is the compiler picking up files (based on include/exclude patterns) the user did not intend to include. Run
I would not assume errors are the cause of slow down. chances are, 1. too many files included in the compilation (you can fix that by adjusting your include/exclude patterns), 2. some type relation is expensive to check (we need to know what is going on, chances are it is a compiler bug), or 3. some auto-generated .js/ minified .js file with complex control flow graph that the compiler is spending too much time analyzing (you can fix this by excluding the file and including a .d.ts file for it). |
@mhegazy thanks a lot for your detailed response. I think our problem is gone for now after we decided to rename all .js files to .ts. It's a lot faster now and the incremental compilations work as expected. So I will go ahead and close this issue. In case it helps anyone, I used the following PowerShell command to do a batch rename:
|
This problem is killing us. Our TS node project started being mind-bogglingly slow since a few days ago and it's hindering our work. I found out as long as I have no
@types\*
modules installed, it works fine but as soon as I add any@types
module, such as@types/bluebird
it gets slow.When all type modules are removed,
tsc
takes about 5 sec to complete (obviously with a lot of errors). With type modules installed, it takes about 30 sec and with typescript@next is it about twice as slow.Here are the diagnostics stats:
tsc version 2.6.2
tsc version 2.7.0-dev.20180116
Here are the type modules that we use:
Also in VSCode, CMD+Click on symbols takes a long time to resolve and when running TS Build Task sometimes we get this error:
Do you have any suggestions how we can fix this problem?
The text was updated successfully, but these errors were encountered: