-
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
TypeScript --watch initial compilation several times slower for the same codebase since 2.8 #25018
Comments
Can confirm, getting this behaviour as well |
This seems like a correct change as part of #21243 since we added support for recursive directory watching on OS that werent supported by node. Can you please use |
Will do, however I cannot comprehend how you can define this as a "correct change", as it made --watch non-useable/broken for development purposes since 2.8 whereas it was until 2.7. |
It was correct change because thats what will give you right behavior. The issue has various options to try out different kinds of watches on different. There is always scope to do optimize based on user experience. |
typescript 3.0.0-dev.20180616
No difference whatsoever. Updated the repository https://github.com/devuo/typescript-slow-watch-bug with this information. You can use it to reproduce the issue. |
I've also seen it scanning recursively folders like .git, go to the depths of node_modules/ and other folders not specified in |
I also tried to use all the different environment variable values for TSC_WATCHFILE and TSC_WATCHDIRECTORY to no avail and made no difference whatsoever, e.g:
|
… and recreate more children watches Helps with #25018
… and recreate more children watches Helps with #25018
There was some improvement (around ~8s in the case of the example codebase I made available for you guys to test and where you can reproduce the behaviour yourselves). However in a bit larger codebase it still takes a whole full minute to start compiling when before it took under 10 seconds. In any case it still feels weird to me to be creating recursively file/folder watchers for directories excluded or not explicitly included in tsconfig, such as Here's the extendedDiagnostics of typescript@3.0.0-dev.20180712 for the https://github.com/devuo/typescript-slow-watch-bug codebase
|
The exclude location only impacts initial list of files, not where module resolution takes place. |
@sheetalkamat nope, no changes. I also added .git/ to excludes, but it appears to be scanning it nonetheless. Will try to check in a bit more detail tomorrow |
@devuo #25811 will help you with watching
which is better than whats in main branch ( where in the only change is |
My experience with 3.1.0-dev.20180726 is much better in watch mode. It's around 10-13s faster than before watching 148 files.
|
Closing this now since we have handled the optimization as best as we can for recursive directory watching where node doesnt support file system level events for recursive watching |
TypeScript Version: 2.9.2, >= 2.8
Search Terms: Slow compilation, Slow watch
Code
The initial watch compilation time issue is not directly reproducible under OSX, and is only manifested when executed under a Docker container. Thus for easier debugging and demonstration of the issue, I've created a repo with all the required code that reproduces the issue and contains additional supporting documentation such as v8 profiling. See the following repository for a reproducible step-by-step instructions and code.
https://github.com/devuo/typescript-slow-watch-bug
Expected behavior:
Initial --watch compilation times should take about the same time the same time as they did in 2.7. Here's how --watch looks like in 2.7 for the codebase referred above:
Actual behavior:
Initial --watch compilation times for the same codebase take many times under >= 2.8 than they did in 2.7. Exact initial compilation times since 2.8 appears to depend on the number of files being scanned under the root project directory. Here's how --watch looks like in 2.9 for the same codebase above:
Here's where 2.9 appears to spend most of its time during a profiling session:
Compare with 2.7:
Related Issues: #22953
The text was updated successfully, but these errors were encountered: