Skip to content

refactor(@angular/build): avoid retaining worker file data for single-batch inlining - #33912

Closed
clydin wants to merge 1 commit into
angular:mainfrom
clydin:perf/i18n-inliner-ephemeral-file-data
Closed

refactor(@angular/build): avoid retaining worker file data for single-batch inlining#33912
clydin wants to merge 1 commit into
angular:mainfrom
clydin:perf/i18n-inliner-ephemeral-file-data

Conversation

@clydin

@clydin clydin commented Aug 24, 2026

Copy link
Copy Markdown
Member

When processing files where all remaining locales fit into a single batch, the file will only be transformed once across all worker threads. Retaining the parsed AST and source code in the worker's long-term fileDataCache leads to monotonic memory growth across multi-file builds without providing any cache reuse.

This change marks single-batch requests as ephemeral, allowing the worker to extract localization metadata and perform inlining within the execution frame without caching the file data long-term. The parsed AST and code are then naturally garbage-collected when the batch action completes.

…-batch inlining

When processing files where all remaining locales fit into a single batch, the file will only be transformed once across all worker threads. Retaining the parsed AST and source code in the worker's long-term `fileDataCache` leads to monotonic memory growth across multi-file builds without providing any cache reuse.

This change marks single-batch requests as `ephemeral`, allowing the worker to extract localization metadata and perform inlining within the execution frame without caching the file data long-term. The parsed AST and code are then naturally garbage-collected when the batch action completes.
@clydin clydin added the target: minor This PR is targeted for the next minor release label Aug 24, 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 an ephemeral option to the i18n inliner worker to avoid caching file data long-term when all remaining locales for a file are processed in a single batch, allowing the data to be garbage-collected sooner. Additionally, it integrates asynchronous initialization of the hashing utility (initializeHash) during the setup of the I18nInliner and its unit tests. There are no review comments, and I have no feedback to provide.

@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Aug 24, 2026
@clydin
clydin requested a review from alan-agius4 August 24, 2026 17:47
@clydin clydin closed this Aug 24, 2026
@clydin clydin reopened this Aug 24, 2026
@clydin
clydin removed the request for review from alan-agius4 August 24, 2026 21:35
@clydin clydin removed action: review The PR is still awaiting reviews from at least one requested reviewer target: minor This PR is targeted for the next minor release labels Aug 24, 2026
@clydin clydin closed this Aug 24, 2026
@clydin
clydin deleted the perf/i18n-inliner-ephemeral-file-data branch August 24, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant