fix(ngcc): do not run in parallel mode if there are less than 3 CPU cores (#36626)
Previously, ngcc would run in parallel mode (using the `ClusterExecutor`) when there were at least 2 CPU cores (and all other requirements where met). On systems with just 2 CPU cores, this meant there would only be one worker process (since one CPU core is always reserved for the master process). In these cases, the tasks would still be processed serially (on the one worker process), but we would also pay the overhead of communicating between the master and worker processes. This commit fixes this by only running in parallel mode if there are more than 2 CPU cores (i.e. at least 2 worker processes). PR Close #36626
This commit is contained in:
parent
9aa778e843
commit
4c63241b34
|
@ -86,8 +86,10 @@ export function mainNgcc(options: NgccOptions): void|Promise<void> {
|
|||
return;
|
||||
}
|
||||
|
||||
// Execute in parallel, if async execution is acceptable and there are more than 1 CPU cores.
|
||||
const inParallel = async && (os.cpus().length > 1);
|
||||
// Execute in parallel, if async execution is acceptable and there are more than 2 CPU cores.
|
||||
// (One CPU core is always reserved for the master process and we need at least 2 worker processes
|
||||
// in order to run tasks in parallel.)
|
||||
const inParallel = async && (os.cpus().length > 2);
|
||||
|
||||
const analyzeEntryPoints = getAnalyzeEntryPointsFn(
|
||||
logger, finder, fileSystem, supportedPropertiesToConsider, compileAllFormats,
|
||||
|
|
Loading…
Reference in New Issue