Skip to content

perf(@angular/build): cache transformed configuration in TypeScript compilation - #34192

Open
alan-agius4 wants to merge 2 commits into
angular:mainfrom
alan-agius4:perf/cache-transformed-configuration
Open

alan-agius4 wants to merge 2 commits into
angular:mainfrom
alan-agius4:perf/cache-transformed-configuration

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

When rootFiles are explicitly provided (e.g. in library builds), re-parsing tsconfig.json and traversing the project directory structure via readConfiguration on every incremental watch rebuild is redundant and adds measurable overhead (~200-350ms on large libraries).

This change caches the TransformedConfiguration in TypeScriptCompilation when explicit rootFiles are provided and invalidates the cache only when a .json configuration file changes.

…ompilation

When `rootFiles` are explicitly provided (such as in library builds), avoid re-reading and re-parsing `tsconfig.json` and traversing the project directory structure on every watch rebuild. Cache the `TransformedConfiguration` and invalidate it only when a `.json` configuration file changes.
@angular-robot angular-robot Bot added area: performance Issues related to performance area: @angular/build labels Sep 28, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a caching mechanism for the TypeScript configuration in the Angular build process to improve performance during watch mode rebuilds. The reviewer suggests enhancing this cache by tracking the 'rootFiles' to ensure the cache is properly invalidated when the set of root files changes, preventing potential compilation errors or stale configurations. All review comments are actionable and provide necessary improvements to the implementation.

Comment thread packages/angular/build/src/tools/angular/compilation/typescript-compilation.ts Outdated
Comment thread packages/angular/build/src/tools/angular/compilation/typescript-compilation.ts Outdated
@alan-agius4 alan-agius4 added target: patch This PR is targeted for the next patch release action: review The PR is still awaiting reviews from at least one requested reviewer requires: TGP This PR requires a passing TGP before merging is allowed freq2: medium target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release requires: TGP This PR requires a passing TGP before merging is allowed labels Sep 28, 2026
@alan-agius4
alan-agius4 requested a review from clydin September 28, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @angular/build area: performance Issues related to performance target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant