refactor(@angular/build): optimize unmodified file and locale handling in i18n inliner - #33950
Merged
alan-agius4 merged 1 commit intoAug 27, 2026
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a fast path in the i18n inliner to skip processing for files that do not contain any active $localize call sites or locale insert sites, improving build performance. It updates the worker and main inliner to handle unmodified files, returning undefined code and maps, and caching them efficiently. The review feedback suggests a further optimization in i18n-inliner.ts to clone the original file directly instead of calling createOutputFile when the file is unmodified, which avoids redundant content hash calculations.
…g in i18n inliner When AST analysis determines that a file has zero $localize call sites and zero locale insert sites, the worker returns a lightweight unmodified batch result immediately, skipping per-locale loops, translation dictionary queries, and sourcemap parsing. For files where transformations occur but a specific locale produces no text modifications, code and sourcemap strings are omitted from the worker result, avoiding redundant serialization over worker IPC. The main thread falls back directly to the existing BuildOutputFile contents and cloned sourcemaps.
clydin
force-pushed
the
perf/i18n-inliner-unmodified-fast-path
branch
from
August 27, 2026 14:15
8dae1af to
e3a9d38
Compare
alan-agius4
approved these changes
Aug 27, 2026
Collaborator
|
This PR was merged into the repository. The changes were merged into the following branches:
|
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 AST analysis determines that a file has zero $localize call sites and zero locale insert sites, the worker returns a lightweight unmodified batch result immediately, skipping per-locale loops, translation dictionary queries, and sourcemap parsing.
For files where transformations occur but a specific locale produces no text modifications, code and sourcemap strings are omitted from the worker result, avoiding redundant serialization over worker IPC. The main thread falls back directly to the existing BuildOutputFile contents and cloned sourcemaps.