-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Allow incremental compilation without emitting updated tsBuildInfo file #40198
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
Comments
@sheetalkamat curious on your thoughts here |
I think the delay you are seeing seems like declaration emit taking longer rather than updating tsbuild info file. So if you run |
I would jump in here and also share that on our project https://github.com/vanilla/vanilla that the typecheck takes 30-40 seconds for the whole project, but then if we turn on Maybe it's worth exploring a warning if so much time is spent in emit when the |
As mentioned #40198 (comment) the most probable cause of this is declaration emit that is used to determine change in shape of a module/file and not emitting tsbuild info file.. you can take a look at that by running |
Search Terms
tsbuildinfo noemit noemitonerror incremental
Suggestion
TS 4 shipped with @sheetalkamat's excellent change #38853, allowing us to use
--incremental --noEmit
to take advantage of incremental compiling for type checking scenarios.While this is great, currently any updates to the graph are always emitted to an updated
tsBuildInfo
file. While this makes sense (to keep the cache always up to date), IMO as a next step it should be possible to use any existingtsBuildInfo
file without in turn emitting an updated one.The motivation is as follows. Our codebase takes a certain amount of time to compile without incremental compilation:
With incremental compilation (no changes), things speed up considerably:
However, a change to a file deep in the DAG (i.e., a central utility file) significantly increases the compile time:
You'll notice that the emit time is the bottleneck here; without it, this would only take ~52 s. Note that the initial emit time (for getting the whole graph built) was about triple the total time above, and the generated file is just <100MB.
Use Cases
My specific scenario is as follows: to minimize TS build time for our developers, our CI on the main branch would run
tsc --incremental --noemit
to generate updatedtsBuildInfo
files and write them to a central location. Developers would then make use of the latest generatedtsBuildInfo
file to quickly run type checks. However, they need not generate updated files locally on the machine, since they'll eventually get updated anyway via the CI's main branch job.I'm not familiar with the implementation, but it appears that the bottleneck is serializing the updated graph. I'm hoping that by "disabling" the emit stage, we would still be able to take advantage of incremental compilation, resulting in a net win over never using it (i.e., worst case incremental compile takes as long as non-incremental compile).
Examples
I'd like to use something like:
tsc --project . --incremental noUpdate --noemit
ortsc --project . --incremental --noEmit --incrementalNoUpdate
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: