-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
Out of memory on a relatively small TypeScript project #183
Comments
Knip is trying to be smart and win performance by combining TS configs of packages that allow so, since Unfortunately in your situation it means the opposite. One potential solution is to offer a flag to disable the optimization, this I will do shortly. And maybe have a way to detect or set a maximum number of TS projects that can be "merged" this way. Any chance you could share the project so I can try and test things? |
Let me try creating a repro first. I don't think the optimization is at fault here, as the slowdown/crash happens even when invoking Knip in just that workspace. |
Ah yes I read that too fast then. Still I think the option is good to have, to (1) spread cpu/memory usage differently, and (2) offer a workaround for potential issues arising from merging the TS configs (e.g. from |
Reproduced: https://github.com/alecmev/knip-repro-183 It is an ancient version of Babylon.js, but |
Thanks for the repro! Here to say I definitely will dig into this more when I have time. First exploration showed that the dependency has like 180 nested dts imports and |
Thank you! We might upgrade to the new Babylon.js soon, alleviating this, but this is still worth looking into. Also, if it doesn't crash on your system, then try creating more copies of |
Updated to Babylon.js 6, and fixed all errors reported with |
Yeah, sorry, didn't get to it. Also not hearing anyone else complain about performance, so there was not much incentive to look into a single case. Glad it resolved itself :) |
Actually, I subscribed here because we also have memory usage issues in Github Actions. We don't use directly We temporarily fixed it by prefixing our script with I must say our project is not as small as the OP. Didn't have time to look into Just sayin', because I read "not hearing anyone else complain about performance" ;) |
Just in case, clean |
Knip v4 is about to mitigate some of these issues: https://knip.dev/blog/slim-down-to-speed-up (you can install and try v4 canary today). Recently added --isolate-workspaces (in v3) which may also help in certain edge cases. |
Hi! First things first, thanks for making Knip, I really like the mission!
I'm setting it up in our monorepo and have run into a few problems. This is the only showstopper, but I'll open a few more issues for the other ones, hope you don't mind.
The package
foo
I'm running it on is somewhat heavy on TypeScript (@typescript-eslint
is noticeably slower on it too, compared to everything else in our monorepo), but it has never caused us trouble like this.I'm running Knip from the root of the repo, like so:
Every package has its own
tsconfig.json
, forfoo
it looks like so:All packages in the repo have the same
extends
and the same compiler options abovejsx
. I've tried removingreferences
,src/package.symlink.json
,"lib": ["dom"]
, to no avail. The outcome looks like so:I've tried ignoring all files except for
index.ts
, in which case Knip doesn't run out of memory, but is still extremely slow:For comparison, here's another similarly heavy package, with nothing ignored:
If I un-ignore more than 1 file beyond
index.ts
then it runs out of memory again.It appears to me that Knip is using the right
tsconfig.json
, and this probably isn't Knip's fault at all, but I'd like to have a little bit more transparency into how it interacts with TypeScripts' language server. Thinking of setting up someconsole.log
s aroundcreateProgram
, to see the exact compiler settings, but reporting here in case you have some pointers.Latest everything.
Thanks!
The text was updated successfully, but these errors were encountered: