You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe there's something unique to my system or my project going on here, but I'm getting very slow performance from tsc when trying to compile a single file from a subdirectory inside a larger project. The larger project is being compiled with parcel and is not using a .tsconfig file right now. I can demonstrate with a trivial example, see code below.
TypeScript Version:
Version 3.8.0-dev.20200109, 3.7, 3.1 for comparison. All had the same issue.
Search Terms:
tsc, typescript compiler very slow in subdirectories, scanning files outside of root, unused files
Code
~/somepath/lib/sound echo"var s: string = 'hello';"> hello.ts
~/somepath/lib/sound time tsc hello.ts
real 0m5.592s # <-- very slow
user 0m9.604s
sys 0m0.473s
~/somepath/lib/sound cp hello.ts /tmp/tstmp/
~/somepath/lib/sound pushd /tmp/tstmp/
/tmp/tstmp ls
hello.ts
/tmp/tstmp time tsc hello.ts
real 0m1.916s # <-- less slow
user 0m3.089s
sys 0m0.187s
Expected behavior:
Compiler should not take >5 seconds for a trivial compilation, and should only look at files referenced by the entry file.
Actual behavior:
When compiling a single trivial file (or even trying to compile a file that does not exist) from a subdirectory within a larger project, the compilation took over 5 seconds, vs <2 in a clean directory. But even the 2 seconds for a trivial compilation seems quite slow.
Related Issues:
Lots of issues refer to slow compilation, but I did not find any describing this specific problem.
The text was updated successfully, but these errors were encountered:
I would speculate that you have a node_modules/@types folder with a bunch of definitions in them. You can validate by passing --listFiles. By default these are picked up and error-checked; you could also try passing --skipLibCheck which would speed this up substantially.
If that's not it, then we'd need more information to try to help diagnose.
You are exactly right. This resolves my problem. But it makes me wonder if the default behavior can (or should) be improved. On the other hand, I know that simply running tsc is a relatively uncommon way of building, and would most often happen in a smaller project that doesn't have a large number of external types included. I guess it's probably not something that needs to be addressed.
Maybe there's something unique to my system or my project going on here, but I'm getting very slow performance from
tsc
when trying to compile a single file from a subdirectory inside a larger project. The larger project is being compiled with parcel and is not using a .tsconfig file right now. I can demonstrate with a trivial example, see code below.TypeScript Version:
Version 3.8.0-dev.20200109, 3.7, 3.1 for comparison. All had the same issue.
Search Terms:
tsc, typescript compiler very slow in subdirectories, scanning files outside of root, unused files
Code
Expected behavior:
Compiler should not take >5 seconds for a trivial compilation, and should only look at files referenced by the entry file.
Actual behavior:
When compiling a single trivial file (or even trying to compile a file that does not exist) from a subdirectory within a larger project, the compilation took over 5 seconds, vs <2 in a clean directory. But even the 2 seconds for a trivial compilation seems quite slow.
Related Issues:
Lots of issues refer to slow compilation, but I did not find any describing this specific problem.
The text was updated successfully, but these errors were encountered: