Skip to content
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

perf(compiler-cli): cache source file for reporting type-checking diagnostics #47471

Closed
wants to merge 1 commit into from

Conversation

JoostK
Copy link
Member

@JoostK JoostK commented Sep 18, 2022

When reporting type-checking diagnostics in external templates we create a ts.SourceFile of the template text, as this is needed to report Angular template diagnostics using TypeScript's diagnostics infrastructure. Each reported diagnostic would create its own ts.SourceFile, resulting in repeatedly parsing of the template text and potentially high memory usage if the template is large and there are many diagnostics reported. This commit caches the parsed template in the template mapping, such that all reported diagnostics get to reuse the same ts.SourceFile.

Closes #47470

@JoostK JoostK added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release area: compiler Issues related to `ngc`, Angular's template compiler compiler: template type-checking labels Sep 18, 2022
@ngbot ngbot bot modified the milestone: Backlog Sep 18, 2022
@JoostK JoostK marked this pull request as ready for review September 18, 2022 13:37
…gnostics

When reporting type-checking diagnostics in external templates we create a
`ts.SourceFile` of the template text, as this is needed to report Angular
template diagnostics using TypeScript's diagnostics infrastructure. Each
reported diagnostic would create its own `ts.SourceFile`, resulting in
repeatedly parsing of the template text and potentially high memory usage
if the template is large and there are many diagnostics reported. This commit
caches the parsed template in the template mapping, such that all reported
diagnostics get to reuse the same `ts.SourceFile`.

Closes angular#47470
@JoostK JoostK added action: merge The PR is ready for merge by the caretaker action: presubmit The PR is in need of a google3 presubmit merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Sep 20, 2022
@JoostK
Copy link
Member Author

JoostK commented Sep 21, 2022

merge-assistance: this needs reapproval for a post-review fixup.

@pkozlowski-opensource pkozlowski-opensource removed the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Sep 21, 2022
@pkozlowski-opensource
Copy link
Member

@JoostK it doesn't merge cleanly to a patch branch. I'm going to re-label it as minor but could you open a separate PR for the patch branch?

@pkozlowski-opensource pkozlowski-opensource added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Sep 21, 2022
@pkozlowski-opensource
Copy link
Member

This PR was merged into the repository by commit 8fcadaa.

@angular-automatic-lock-bot
Copy link

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 Oct 22, 2022
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 action: presubmit The PR is in need of a google3 presubmit area: compiler Issues related to `ngc`, Angular's template compiler compiler: template type-checking target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OptionalChainNotNullableCheck causes heap out of memory error
3 participants