Repository navigation
refactor(@angular/build): optimize unmodified file and locale handling in i18n inliner - #33950
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.
8dae1af to
e3a9d38
Compare
|
This PR was merged into the repository. The changes were merged into the following branches:
|
|
This pull request 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 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.