-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
--watch compilation with no change takes 3 seconds #31932
Comments
Are you using |
Oh, I forgot to mention. Since I'm using project reference, so all my modules have |
Did another experiment, where I converted the project into a singular project, without project reference. Now touching a file without any change and trigger compilation under Update: With singular project, it has to be |
@ZenoZen For scalability we do not yet cache module resolution across compilations in watch mode with |
@sheetalkamat Thanks for replying! So it means that recompilation with either Is there anything I can do for now to make it better, other than switching back to non-referenced project structure? |
@sheetalkamat let's think long-term about possible improvements here |
It seems that with incremental tsc still parse all files? I would think that if hash is the same there should be no need to parse files ? In my case incremental makes compilation slower: {
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "es2018",
"strict": false,
"sourceMap": true,
"declaration": true,
"emitDeclarationOnly": true,
"allowJs": false,
"incremental": true,
"composite": true,
"esModuleInterop": true,
"jsx": "react",
"rootDir": "src",
"outDir": "types",
"skipLibCheck": true,
"tsBuildInfoFile": "types/tsBuildInfo.json",
"types": [
"react",
"jest",
"prop-types",
],
"lib": [
"esnext",
"dom"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.json"
],
"exclude": [
"src/**/*.test.ts",
"src/**/*.test.tsx"
]
}
Result in
After nuking outDir and disabling incremental {
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "es2018",
"strict": false,
"sourceMap": true,
"declaration": true,
"emitDeclarationOnly": true,
"allowJs": false,
"incremental": false,
"composite": false,
"esModuleInterop": true,
"jsx": "react",
"rootDir": "src",
"outDir": "types",
"skipLibCheck": true,
"types": [
"react",
"jest",
"prop-types"
],
"lib": [
"esnext",
"dom"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.json"
],
"exclude": [
"src/**/*.test.ts",
"src/**/*.test.tsx"
]
}
I am using latest version of tsc. |
@chyzwar Yeah, IMU, Right now I actually moved to lerna/yarn workspaces sort of project structure as the codebase grows, but because of this issue, I have to hack how |
I think that I'm seeing this same issue. My simplified test configs as a gist: https://gist.github.com/garybernhardt/5c5aeb9d1bb361d28b34a1f6c3aa0a3b. Our app is closed-source, so I can't post it for repro. I did try to make a minimal repro app, but the lack of actual source to compile made the builds so fast that I couldn't measure the incremental build slowdown. Here are some data points about build times with various configurations. This is on 3.7.0-dev.20191018. I'm measuring tsc's self-reported timestamps, seven trials in each case, from "Starting incremental compilation..." until "Found 0 errors." In each case I'm adding or removing a single
The last one shows this becoming prohibitively slow, and is similar to the timings that I saw when building our full system (client, server, and common). Our project is a bit bigger than @ZenoZen's, but definitely not large (193 TS files, 16,924 lines of TS). Slowdown seems to be ~20x on identical source code. |
Is any work on this planned? |
Looks like I've faced the same issue. The build time for non-composite project in watch mode for the only 1 change is fast (around 2-3 seconds), but for the same project in Our project is closed-source, but let me know if I can provide any to help to fix it. Composite project is really great feature and we're going to move our codebase to it, but the issue is blocker for that (we can't wait for 1 minutes for the only 1 file change).
@sheetalkamat what's the difference between the same project without Without
|
Hi @RyanCavanaugh, may I ask to say what kind of proposal we expect here? How to fix slowness of compilation or something else? Maybe somebody from this thread needs to provide more information which might help to choose better solution? |
In my case the issue was fixed after upgrading to the the version |
If people here would be willing to try out tomorrow's nightly build, we'd appreciate the feedback! |
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.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:
The text was updated successfully, but these errors were encountered: