-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Bug]: findRepos
works slowly with a large number of projects
#14818
Comments
Interesting! Do we know why it regressed so much in 18.13? As for mitigations, easiest is probably just to avoid shelling out at all. Maybe walking the file system looking for |
I'm not sure, at first sight, only nodejs/node@7b68c06988 is related to
Yes, that could be an option! In my project, to mitigate this issue quickly knowing there is only one repo, I've made changes via patch-package 😄 |
FWIW, #14826 helps a bit before the I found https://github.com/antongolub/git-root - I wonder if we should use that? I'd assume just fixing |
Using git-root sounds good to me, but I'm not following how changing only |
bah, of course... Mixing VCS-es sounds horrible, but I bet we'd break somebody if we looked for only looked for Mercurial and Sapling if we didn't find git roots. I see that we find the VSC roots for every test run. I bet we could at least resolve those when normalizing config instead, so at least we'd only get the hit at the start of runs rather than every re-run. #14826 should help a bit, btw |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Version
29.7.0
Steps to reproduce
nvm use 20.10.0
npm ci
npm test packages/package-1/example.test.js -- --watch
You can reproduce this issue on any Node.js version starting at 18.13.0 by having a large number of
projects
.Expected behavior
--watch mode doesn't consume large amounts of resources and works fast.
Actual behavior
--watch mode is resource-intensive, works slowly and slows down the whole system.

Additional context
Why it's slow
findRepos is sluggish because of running a ton of
childProcess.spawn
under the hood (three processes per each project). It worked fast enough until Node.js version 18.13.0 was released, and this issue still persists even in the latest Node version (21.5.0).Performance footprint for 30s
node --inspect-brk ./node_modules/.bin/jest packages/package-1/example.test.js --watch
Node.js 18.12.1

Node.js 18.13.0 (and any later ones)

Possible ways to solve it
execa
, the current version that you use (5.0.0) is quite outdated, the latest is 8.0.1, there were some optimisation tweaksonlyOneRepo: boolean
orrepo: string
Environment
The text was updated successfully, but these errors were encountered: