Skip to content

refactor(@angular/build): cache persistent binary translation buffers in i18n inliner - #33952

Merged
alan-agius4 merged 2 commits into
angular:mainfrom
clydin:perf/i18n-translation-buffer-caching
Aug 28, 2026
Merged

refactor(@angular/build): cache persistent binary translation buffers in i18n inliner#33952
alan-agius4 merged 2 commits into
angular:mainfrom
clydin:perf/i18n-translation-buffer-caching

Conversation

@clydin

@clydin clydin commented Aug 27, 2026

Copy link
Copy Markdown
Member

Persist binary SharedArrayBuffer translation layouts on disk in .angular/cache keyed by translation file integrity hash.

The I18nInliner creates a dedicated #translationCache instance under namespace 'translations' alongside #transformedFileCache under namespace 'transforms'. During locale serialization, translationCache.getOrCreate deduplicates in-flight encoding and restores pre-built binary buffers directly from disk, skipping translation dictionary binary encoding on warm builds.

… in i18n inliner

Persist binary SharedArrayBuffer translation layouts on disk in .angular/cache
keyed by translation file integrity hash.

The I18nInliner creates a dedicated #translationCache instance under namespace
'translations' alongside #transformedFileCache under namespace 'transforms'.
During locale serialization, translationCache.getOrCreate deduplicates in-flight
encoding and restores pre-built binary buffers directly from disk, skipping
translation dictionary binary encoding on warm builds.
@clydin clydin added the target: minor This PR is targeted for the next minor release label Aug 27, 2026
@clydin
clydin marked this pull request as ready for review August 27, 2026 19:54

@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 persistent caching for binary translation buffers in the i18n inliner when a translationIntegrity hash is provided. It updates serializeTranslation to be asynchronous, allowing it to retrieve or store serialized translations in a new translations cache. Additionally, it renames the existing transform cache to transformedFileCache, adds a check to prevent duplicate locales in inlineAll, and includes comprehensive unit tests to verify the caching behavior and error handling. I have no feedback to provide as there are no review comments.

@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Aug 27, 2026
@clydin
clydin requested a review from alan-agius4 August 27, 2026 19:57
… batch request in i18n inliner

Streamline WorkerPool initialization by removing global files Map from workerData.
Instead of storing all file Blobs in workerData for the worker pool lifetime,
pass code and sourcemap Blobs on demand per inlineFileBatch request.

On the worker thread, loadFileData consumes the passed code Blob on initial cache misses
and continues to cache pre-parsed OXC AST metadata in worker thread memory, preserving
100% of worker AST parsing speed while improving V8 Young Generation garbage collection.
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 28, 2026
@alan-agius4
alan-agius4 merged commit fc80beb into angular:main Aug 28, 2026
39 of 40 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants