-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
Replace fork-ts-checker-webpack-plugin
with faster alternative
#13529
Conversation
1783384
to
27fbf43
Compare
You will no doubt will (and should!) pick the approach that works best for you. Couple of things to note in case there are properties of the
Of course, please make the calls that work for your project, I just wanted to let you know some possibilities 🤗 |
@johnnyreilly Thanks for reaching out! We were pretty happy with the plugin overall, but there's a few things other than speed that motivated this change:
Thanks for mentioning that newer versions may have seen speed improvements! To elaborate more on the speed we were observing: I may have some spare time tomorrow to see what the speed is like on the new version(s). |
Thanks for the detailed response @Timer! It does sound like you're planning some pretty hefty (and cool sounding!) architectural changes. Super interesting that you don't run type checking in development - that's where I particularly appreciate it!
This is a really interesting idea. I'm very curious as to how it works out.
Super interesting - as the name suggests, the initial motivation for Sounds like you're going all in on this. Fascinating. If you do get a chance to compare v4 and v5 alpha performance we'd love to get an idea of the numbers. Thanks again for sharing the ideas here - really appreciate it! |
@johnnyreilly I just ran some fresh tests on the latest version of our project: Base build: 7s (no TypeScript features enabled)
All of these tests were run 3 times and repeat-accurate within +/- 0.5s. It seems v4 helped (and doesn't burn CPU), but v5 re-regressed. This PR is still beating the plugin by 60+ seconds. Would love to go more in-depth sometime to figure out the performance bottleneck! |
Thanks @Timer - that's tremendously helpful! @piotr-oles it looks like there's a performance degradation with v5 - see the numbers from @Timer above. |
Thank you again for reaching out! ❤️ 🚀
Missed this bit! We disabled it because users (and us) experienced slower dev-time compilations, despite using I'd be happy to help/collab to figure out the upstream issue though so we don't have to maintain this ourselves. We're also exploring ESLint in the future, so this all parlays. |
Did you use the ESLint integration in fork-ts-checker-webpack-plugin BTW? My own use case is running |
We did not: strictly the TypeScript integration. Next.js doesn't (currently) ship with any form of ESLint (not even The DX we're aiming for (in dev) is that TS/ESLint errors show up in a toast though, and not a full overlay ("compile error"). For posterity, here was our config: new _forkTsCheckerWebpackPlugin.default(
_pnpWebpackPlugin.default.forkTsCheckerOptions({
typescript: typeScriptPath,
async: false,
useTypescriptIncrementalApi: true,
checkSyntacticErrors: true,
tsconfig: tsConfigPath,
reportFiles: ["**", "!**/__tests__/**", "!**/?(*.)(spec|test).*"],
compilerOptions: { isolatedModules: true, noEmit: true },
silent: true,
formatter: "codeframe",
})
); Just tested: removing |
Yeah that was exactly why I wrote https://github.com/johnnyreilly/fork-ts-checker-notifier-webpack-plugin Though I wanted all lints / errors as notifications / toasts. Something very lovely about having errors as toasts outside of the application. I've never really enjoyed the full overlay approach; I like to have the application running even if it does contain errors. I find value in being able to debug a broken application - particularly if it's a type system error which may not massively impair functionality. |
Incidentally, I've an idea that
Incidentally, https://www.twitter.com/orta/status/1260583041740812288 announced by @orta |
@Timer Thanks for the benchmark, I will try to investigate why there is such a big difference between |
It's already true in the benchmarks @Timer did (so didn't affect the slowdown) |
@Timer Could you tell me how can I check timings on my local machine? I cloned the repository and checkout master branch but I'm not sure which command I should run to use fork-ts-checker-webpack-plugin :) |
@piotr-oles the project we're testing with is a private one (that powers our website), happy to provide anything you need to see tho (minus full repo). |
@Timer Ok, I will try on different repository :) Could you tell me which version of the typescript did you use for tests? |
|
Thanks :) If someone has a project that can share and that is significantly slower with |
I did some research regarding plugin performance and these are outcomes:
|
Awesome @piotr-oles 🚀 |
…cel#13529) This removes `fork-ts-checker-webpack-plugin` and instead directly calls the TypeScript API. This is approximately 10x faster. Base build: 7s (no TypeScript features enabled) - `[email protected]`: 90s, computer sounds like an airplane - `[email protected]`: 84s, computer did **not** sound like an airplane - `[email protected]`: 90s, regressed - `npx tsc -p tsconfig.json --noEmit`: 12s (time: `18.57s user 0.97s system 169% cpu 11.525 total`) - **This PR**: 22s, expected to get better when we run this as a side-car All of these tests were run 3 times and repeat-accurate within +/- 0.5s.
This removes
fork-ts-checker-webpack-plugin
and instead directly calls the TypeScript API.This is approximately 10x faster.
Base build: 7s (no TypeScript features enabled)
[email protected]
: 90s, computer sounds like an airplane[email protected]
: 84s, computer did not sound like an airplane[email protected]
: 90s, regressednpx tsc -p tsconfig.json --noEmit
: 12s (time:18.57s user 0.97s system 169% cpu 11.525 total
)All of these tests were run 3 times and repeat-accurate within +/- 0.5s.