-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Slow incremental compilation when noEmitOnError is true #37867
Comments
noEmitOnError
is true
Should look into writing tsbuildinfo file when there are errors with noEmitOnError so semantic errors are cached.. Needs more depth investigation since this affects |
I also ran into the issue (in my case it increases the re-compilation time in watch mode from 25 to ~70 seconds). Please ping me if I need to provide any additional information. |
I should say that disabling Diagnostics (in watch mode, incremental build):
Cpu profile for Cpu profile for |
Should be fixed by #38853 |
Thank you @sheetalkamat. "noEmitOnError" is a popular feature, so your fix hugely improves performance for many users. |
TypeScript Version: 3.8.3
Search Terms: slow compilation, slow incremental compilation, declaration diagnostics, slow
noEmitOnError
Code
I'm trying to debug why incremental TypeScript compilation is slow on my project when using
noEmitOnError
option. A clean compilation takes around 12s and an incremental compilation after a simple change takes around 10s. Turning offnoEmitOnError
takes the incremental compilation time down to 1.6s.Based on the CPU profiles, it looks like bulk of the time is spent in
getDeclarationDiagnostics
, which is only triggered pre-emit whennoEmitOnError
is turned on.tsconfig.json
:Using
tsc --incremental --noEmitOnError
andtsc --incremental
:Diagnostics:
noEmitOnError true
noEmitOnError true
noEmitOnError false
noEmitOnError false
Expected behavior:
Enabling
noEmitOnError
should not signficantly increase incremental compilation time. In the project above, I would expect a simple incremental compilation to take 1-2 seconds, i.e. similar to whennoEmitOnError
isfalse
.Actual behavior:
Incremental compilation after a simple change takes around 10 seconds, which is almost the same as the 12 seconds it takes to perform a clean compilation.
Playground Link: -
Related Issues:
Not a directly related issue but Document --incremental and composite project APIs #31849 (comment) indicates declaration diagnostics are collected by doing in-memory emit.
A different kind of slowness report related to
noEmitOnError
: Compiler API (language service) becomes incredibly slow whennoEmitOnError = true
#24444The text was updated successfully, but these errors were encountered: