refactor(ngcc): add debug logging for the duration of different operations (#32427)

This gives an overview of how much time is spent in each operation/phase
and makes it easy to do rough comparisons of how different
configurations or changes affect performance.

PR Close #32427
This commit is contained in:
George Kalpakas
2019-08-29 18:51:02 +03:00
committed by Matias Niemelä
parent e36e6c85ef
commit c714330856
4 changed files with 34 additions and 1 deletions

View File

@ -141,6 +141,9 @@ export function mainNgcc(
// The function for performing the analysis.
const analyzeEntryPoints: AnalyzeEntryPointsFn = () => {
logger.debug('Analyzing entry-points...');
const startTime = Date.now();
const supportedPropertiesToConsider = ensureSupportedProperties(propertiesToConsider);
const moduleResolver = new ModuleResolver(fileSystem, pathMappings);
@ -197,6 +200,11 @@ export function mainNgcc(
unprocessableEntryPointPaths.map(path => `\n - ${path}`).join(''));
}
const duration = Math.round((Date.now() - startTime) / 1000);
logger.debug(
`Analyzed ${entryPoints.length} entry-points in ${duration}s. ` +
`(Total tasks: ${tasks.length})`);
return getTaskQueue(inParallel, tasks, graph);
};