-
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
[3.6.3] tsc --watch
extremely slow (regular tsc
compiles fine).
#34916
Comments
I also tried the following:
|
@samuraijack It is intentional that incremental depends on declaration emit to decide minimal dependency graph to build.. Your project reports errors with typescript@next so I cant see whats going on in there but I tried with the 3.4 release that it uses and declaration takes long because of circularity and it shows up in the declaration emit run which takes long.. |
Probably same as #34119 |
Just a FYI, even if you can't figure out how to isolate a repro, explicitly writing return types on all of your exported functions can usually improve your perf. Now, when you can figure out which return type, specifically, shaves off the most time; then you have a repro. ;) |
@sheetalkamat Well, point is, that incremental compilation produces a result, different from the regular compilation. This feels like a serious design limitation somewhere in the incremental compilation process (I guess in the declaration serialization format). I really believe both compilation modes should produce exactly the same results. Is this fact admitted as a problem by the TS team? Should this be filed as a separate issue? @weswigham Thanks for the info! |
@sheetalkamat Do you know if it's possible to do the I don't think it's intended for the Would be great if Typescript could move away from emitting serialized declarations for the dependency graph and rely on something else instead. Could it be possible to rely on webpack somehow? I'm not sure. I just need an input from someone who knows the insides of Typescript. Edit: I've tried finding which parts of my code cause the build to be so slow with emit, but had no success. Most of the time seems to be spent on making the redux store typings (CombinedStore stuff). I have a lot of redux modules. I couldn't isolate one type or one file that's causing issues, seems to just be the sheer amount of code. |
@grumd we use d.ts emit to determine if the shape of the file has changed to figure out if we need to emit and re-query semantic diagnostics only the changed file or its dependency graph. While this cannot be change, created #41219 which could help where you pass a new flag to say dont generate .d.ts file to determine change in shape of the file and assume that all changes affect the whole dependency tree rather than being local change. |
@sheetalkamat How does ts-server work in this regard? Recompilation in ts-server seems to be very fast in my project (when running typechecking in VSCode), but "tsc --watch" is very slow, and "tsc" is okay-ish, but slower than VSCode TS recompilation. I guess ts-server somehow recompiles fast without emitting d.ts? Why can't tsc --watch use the same approach as ts-server? |
We've done a lot of changes in the watch space since this was last looked at. Please open a new issue with concrete repo steps if you're still hitting this. Thanks! |
For my codebase, compilation with
--watch
is extremely slow and sometimes results in the out-of-memory segfault. Compilation w/o--watch
take 4s.Can be reproduced in this repo: https://github.com/bryntum/chronograph/ (publicly available, branch
quark_master
, revision c58bc18120021423c730c9c2287058066157b8fa).I found a similar issue, #34119 and tried few recommendations from it. Notably, tried to enable
which produced 251 compilation errors. W/o those options all compiles fine.
It seems the incremental compilation uses some different data structures, than normal compilation. Or, may be, the serialization format is incorrect.
The text was updated successfully, but these errors were encountered: