refactor(@angular/build): bypass worker dispatch for untransformed files in JS transformer - #33797
Open
clydin wants to merge 1 commit into
Open
refactor(@angular/build): bypass worker dispatch for untransformed files in JS transformer#33797clydin wants to merge 1 commit into
clydin wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the JavaScriptTransformer to support Uint8Array inputs, optimizing performance by avoiding UTF-8 decoding when no sourcemap comments are present and transferring standalone ArrayBuffers to worker threads. However, removing the throttle wrapper from the file transformation method can lead to EMFILE errors and memory exhaustion due to concurrent file reads. To address this, the throttle should be kept at the file-reading level and removed from the worker pool dispatch to prevent deadlocks. Additionally, the sourcemap comment detection should be made more robust by searching for sourceMappingURL= to capture legacy and block comment formats.
…les in JS transformer Make transformData symmetrical to accept both string and Uint8Array inputs, allowing transformFile to directly delegate to transformData after reading from disk or cache. When no transformations are required, untransformed files bypass worker pool dispatch, thread synchronization, and string decoding overhead. In addition, introduce a fast byte-level check on raw ASCII bytes using a pre-allocated comment buffer to immediately return untouched buffers when no sourcemap comment exists.
clydin
force-pushed
the
perf/optimize-transformer-fast-path
branch
from
August 6, 2026 15:42
2e7a666 to
9f90003
Compare
alan-agius4
approved these changes
Aug 6, 2026
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.
Make transformData symmetrical to accept both string and Uint8Array inputs, allowing transformFile to directly delegate to transformData after reading from disk or cache. When no transformations are required, untransformed files bypass worker pool dispatch, thread synchronization, and string decoding overhead. In addition, introduce a fast byte-level check on raw ASCII bytes using a pre-allocated comment buffer to immediately return untouched buffers when no sourcemap comment exists.