refactor(@angular/build): avoid retaining worker file data for single-batch inlining - #33912
Closed
clydin wants to merge 1 commit into
Closed
refactor(@angular/build): avoid retaining worker file data for single-batch inlining#33912clydin wants to merge 1 commit into
clydin wants to merge 1 commit into
Conversation
…-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.
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
fileDataCacheleads 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.