Skip to content
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

Type check is slow in incremental mode on watch mode's subsequent runs (not on the first run). #835

Open
EugeneGarbuzovPublic opened this issue Jan 10, 2024 · 1 comment

Comments

@EugeneGarbuzovPublic
Copy link

Current behavior

Type check is slow in incremental mode on watch mode's subsequent runs (not on the first run).

Expected behavior

Type check in incremental mode on watch mode's subsequent runs (not on the first run) has the same or comparable performance as in non-incremental mode.

Steps to reproduce the issue

  1. Set "incremental": true in tsconfig.
  2. Set build: true, mode: 'write-references' in fork-ts-checker options, as in the guide.
  3. Run pnpm start.
  4. After compilation and type check finish, modify src/index.tsx (e. g. add an empty comment) and save file.
  5. Note that after watch mode recompilation fork-ts-checker's type check finishes in approximately 2 seconds after compilation finishes. You may modify and save src/index.tsx multiple times to make sure.
  6. Stop pnpm start process.
  7. Remove "incremental": true from tsconfig, build: true, mode: 'write-references' from fork-ts-checker options.
  8. Repeat steps 3-4.
  9. Note that after watch mode recompilation fork-ts-checker's type check finishes within some milliseconds after compilation finishes. It looks as if it's almost immediate. You may modify and save src/index.tsx multiple times to make sure. Compare that to the results of step 5.

Please note that such a small value of 2 seconds is only on the reproduction repository. On a real-life project type check ends 35 seconds after compilation ends. After every file save.
At the same time without incremental mode type check finishes within a couple of seconds after compilation ends.

Is that the expected behaviour of incremental mode? Or is it a bug?

Issue reproduction repository

https://github.com/EugeneGarbuzovPublic/slow-incremental

Environment

  • fork-ts-checker-webpack-plugin: 9.0.2
  • typescript: 5.3.3
  • eslint: 8.56.0
  • webpack: 5.89.0
  • os: Windows 11 Pro 22H2 22621.2861
@EugeneGarbuzovPublic
Copy link
Author

Seems like the issue is in the typescript.build option.

I tried setting only the mode: 'write-references' option and I did not set the build: true option.

Now on our production project the whole build (including the whole type check) consistently takes ~104 seconds. And the issue with subsequent type check runs is gone, subsequent type checks finish almost instantly. With incremental mode turned off the whole build consistently took ~112 seconds.

And with only mode: 'write-references' being set without the build: true the plugin emits the .tsbuildinfo file perfectly fine, in spite of what is written in the docs.

I tried setting mode: 'write-tsbuildinfo' as well, and it seems like it works just the same way as mode: 'write-references' in my case. Again, in spite of what is written in the docs. The build still takes ~104 seconds.

Maybe docs update is required?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants