-
Notifications
You must be signed in to change notification settings - Fork 46
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
performance mystery of jest --runInBand #46
Comments
How many cores do you have? In my experience jest requires 4+ to be able to parallelize effectively. |
@ljharb I'm running on a 2.3 GHz Intel Core i7 : ) In the stats above, running |
It might be a good idea to try to cache the jest-runner-eslint/src/runESLint.js Lines 13 to 15 in e6ad060
It might be that simply spinning up a Not that it should impact |
What kind of black magic is this ? |
I think we should be able to memoize the CLIEngine instance. |
A lot of time has passed since this issue was opened. Has there been any progress on this? It is a very interesting issue. |
Still seeing this, almost 3 years on.
|
I'm experiencing the same issue and it seems to be because the slowest thing is the module resolution process its done multiple times when not using |
There are two things that come to mind regarding a slowdown in parallelised execution like this:
(2) feels like the likely culprit in this case, but what resource would the workers be contentious on every time they run. Looking at the It feels like it is more likely down to the ESLint implementation itself - it is not expecting to run in parallel. Each parallel instance is going to be loading the same config, and the same rules, for example. It may also be sharing the same cache for any ASTs (abstract syntax trees) it generates. Maybe that is creating a situation where one worker has to wait for another worker to finish accessing something before it can do its work. I wonder if it will be useful to see what files are getting accessed and when while things run in band versus in parallel; that may indicate if there is a bottleneck associated with file access. It could also just be that ESLint startup is slow and when executed in a single worker, the process is able to cache things like the imported files so that the startup is faster on subsequent runs. However, since it's so slow, it makes things MUCH slower when started up n times for n workers. That could be investigated by including some timing output for the main setup code - so we can see how long the first run takes versus subsequent runs within the same worker. |
Lately I have discovered that our application source code has multiple circular references between the file dependencies using import statements. It could be related to that. |
Currently using jest-runner-eslint to lint src before test in TDD and was trying to speed up the lint process, while controversially I found
jest --runInBand
delivers better linting performance than linting multiple files in parallel byjest
.So this brings me the question, what is making
jest --runInBand
actually faster to run jest-runner-eslint?Some stats:
time npx jest --runInBand
:time npx jest
:(averagely, it is 10% slower than jest --runInBand)
time npx eslint src
:(faster)
time npx eslint_d src
:(super fast when run for not first time)
It would be really nice to support eslint_d to speed up the lint process and get more immediate feedback in TDD.
The text was updated successfully, but these errors were encountered: