Description
I have a project that's fairly small (167 project TS files, ~8000 lines of code, and 987 total TS files including libraries).
When I work on one of the top modules (I use referenced projects and have 5 modules, the top one is a webserver module that depends on a bunch of heavy TS libraries like nestjs), even though I just save the file as it is (or touch webserver/x.ts
), the triggered watch compilation takes about 4 seconds to finish, which is not very efficient to work with.
Results of tsc -b tsconfig.json -w --diagnostics
showing most of the time is in parsing and binding.
[8:23:06] File change detected. Starting incremental compilation...
Files: 987
Lines: 422816
Nodes: 1248135
Identifiers: 453635
Symbols: 273809
Types: 73
Memory used: 783590K
I/O read: 0.44s
I/O write: 0.01s
Parse time: 2.95s
Bind time: 0.55s
Check time: 0.00s
Emit time: 0.00s
Total time: 3.50s
[8:23:10] Found 0 errors. Watching for file changes.
I did some simple profiling of tsc.js with the process above, and it appears the compiler takes significant amount of time scanning all the modules, but my gut feeling is all these files/dependencies can be cached.
I wonder if there's any obvious mistakes I'm making, or it's an item on the roadmap since it'd be a big improvement if this can be better.
TypeScript Version: 3.5.2
Search Terms:
Expected behavior:
Since no program change happens, it should be nearly instant to finish the compilation.
Actual behavior:
It takes 3-4 seconds to finish the watch compilation.
Playground Link:
Related Issues: