Open matejchalk opened 6 months ago
Have you considered using the worker_threads
module from node to run in parallel? I would not be surprised if Nx would use a similar approach where the integer passed to parallel is the number of workers.
Have you considered using the
worker_threads
module from node to run in parallel? I would not be surprised if Nx would use a similar approach where the integer passed to parallel is the number of workers.
My assumption was incorrect!
I guess that could also work. I'm honestly not sure what the pros/cons would be of multi-threading instead of multi-processing. Since we're already using processes on the project (eslint
is executed as a process, and we have a convenient executeProcess
wrapper which promisifes spawn
from child_process
module), they should be more straightforward to implement. But could be worth investigating threads as an alternative.
User story
For large Nx monorepos, it could help speed up Code PushUp runs if ESLint could run on different projects in parallel instead of sequentially. Adding an option to enable parallel execution, and even set the max number of processes, would give Code PushUp users more flexibility to optimize for performance. A lot like Nx's
--parallel
flag.Acceptance criteria
parallel?: boolean | number
option is added toeslintPlugin
initializerparallel: false
parallel: 4
), then projects are chunked by this max valuePromise.all
andexecuteProcess
parallel: true
enables parallel execution with maximum set toos.cpus().length
@code-pushup/utils
@code-pushup/eslint-plugin
Implementation details
No response