Sitelet https://github.com/angular/angular/pull/39254
Skip to content

perf(ngcc): do not rescan program source files when referenced from m… - #39254

Closed
JoostK wants to merge 2 commits into
angular:masterfrom
JoostK:ngcc/fast-program-deps
Closed

JoostK wants to merge 2 commits into
angular:masterfrom
JoostK:ngcc/fast-program-deps

Conversation

@JoostK

@JoostK JoostK commented Oct 13, 2020 •

Copy link
Copy Markdown
Member

…ultiple root files

When ngcc is configured to run with the --use-program-dependencies
flag, as is the case in the CLIs asynchronous processing, it will scan
all source files in the program, starting from the program's root files
as configured in the tsconfig. Each individual root file could
potentially rescan files that had already been scanned for an earlier
root file, causing a severe performance penalty if the number of root
files is large. This would be the case if glob patterns are used in the
"include" specification of a tsconfig file.

This commit avoids the performance penalty by keeping track of the files
that have been scanned across all root files, such that no source file
is scanned multiple times.

Fixes #39240

@JoostK JoostK added target: patch This PR is targeted for the next patch release comp: ngcc P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Oct 13, 2020
@ngbot ngbot Bot added this to the needsTriage milestone Oct 13, 2020
@google-cla google-cla Bot added the cla: yes label Oct 13, 2020
@JoostK
JoostK marked this pull request as ready for review October 13, 2020 21:35
@JoostK JoostK added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 13, 2020

@petebacondarwin petebacondarwin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @JoostK. Thanks. LGTM - just a couple of minor comments that you can choose what to do with. Oh and the commit message has a typo: CLIs -> CLI's.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* all files that are imported from the file, while keeping the set of already seen files
* all files that are imported from the file, while taking the set of already seen files

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that something sounded off here!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth just checking the args to those three calls? Or at least the file arg?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no-root sounds a bit weird to me. How about not-root?

@petebacondarwin petebacondarwin added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 14, 2020
…ultiple root files

When ngcc is configured to run with the `--use-program-dependencies`
flag, as is the case in the CLI's asynchronous processing, it will scan
all source files in the program, starting from the program's root files
as configured in the tsconfig. Each individual root file could
potentially rescan files that had already been scanned for an earlier
root file, causing a severe performance penalty if the number of root
files is large. This would be the case if glob patterns are used in the
"include" specification of a tsconfig file.

This commit avoids the performance penalty by keeping track of the files
that have been scanned across all root files, such that no source file
is scanned multiple times.

Fixes angular#39240
@JoostK
JoostK force-pushed the ngcc/fast-program-deps branch from 1063eab to fe3c922 Compare October 14, 2020 11:33
@JoostK JoostK added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Oct 14, 2020
@atscott atscott closed this in 898be92 Oct 14, 2020
atscott pushed a commit that referenced this pull request Oct 14, 2020
…ultiple root files (#39254)

When ngcc is configured to run with the `--use-program-dependencies`
flag, as is the case in the CLI's asynchronous processing, it will scan
all source files in the program, starting from the program's root files
as configured in the tsconfig. Each individual root file could
potentially rescan files that had already been scanned for an earlier
root file, causing a severe performance penalty if the number of root
files is large. This would be the case if glob patterns are used in the
"include" specification of a tsconfig file.

This commit avoids the performance penalty by keeping track of the files
that have been scanned across all root files, such that no source file
is scanned multiple times.

Fixes #39240

PR Close #39254
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Nov 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ngcc is extremely slow with --use-program-dependencies

3 participants