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
Conversation
packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.ts
Outdated
Show resolved
Hide resolved
6211b4e
to
e73ea93
Compare
…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
e73ea93
to
289e7f5
Compare
merge-assistance: this needs reapproval for a post-review fixup. |
@JoostK it doesn't merge cleanly to a patch branch. I'm going to re-label it as |
This PR was merged into the repository by commit 8fcadaa. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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 ownts.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 samets.SourceFile
.Closes #47470