Skip to content

perf(@angular/build): bypass worker dispatch for files without transform candidates - #33986

Merged
clydin merged 1 commit into
angular:mainfrom
clydin:perf/js-transformer-fast-path
Sep 2, 2026
Merged

perf(@angular/build): bypass worker dispatch for files without transform candidates#33986
clydin merged 1 commit into
angular:mainfrom
clydin:perf/js-transformer-fast-path

Conversation

@clydin

@clydin clydin commented Sep 1, 2026

Copy link
Copy Markdown
Member

Files that require neither Angular linking nor advanced optimizations previously underwent full worker thread IPC dispatch, worker deserialization, and AST processing.

By evaluating a fast candidate check on the main thread directly on raw data buffers, files that cannot be modified by advanced optimizations immediately return the original data buffer without worker dispatch or AST parsing.

@clydin clydin added the target: minor This PR is targeted for the next minor release label Sep 1, 2026
@angular-robot angular-robot Bot added area: performance Issues related to performance area: @angular/build labels Sep 1, 2026

@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 a fast-path pre-filter, hasAdvancedOptimizationCandidates, in javascript-transformer.ts to bypass worker dispatch and AST parsing when JavaScript code does not contain candidate constructs for advanced optimizations. The corresponding unit tests are updated and expanded to cover this new bypass logic. The reviewer suggests optimizing the string-matching logic in the pre-filter by using a compiled regular expression instead of multiple sequential includes checks, and adding an additional unit test to verify worker dispatch when decorator tokens are present and sideEffects is false.

Comment thread packages/angular/build/src/tools/esbuild/javascript-transformer.ts
…orm candidates

Files that require neither Angular linking nor advanced optimizations previously underwent full worker thread IPC dispatch, worker deserialization, and AST processing.

By evaluating a fast candidate check on the main thread directly on raw data buffers, files that cannot be modified by advanced optimizations immediately return the original data buffer without worker dispatch or AST parsing.
@clydin
clydin force-pushed the perf/js-transformer-fast-path branch from 7221f95 to 108bd2a Compare September 1, 2026 18:14
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Sep 1, 2026
@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 Sep 2, 2026
@clydin
clydin merged commit 6ee559c into angular:main Sep 2, 2026
68 of 69 checks passed
@clydin

clydin commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

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

@clydin
clydin deleted the perf/js-transformer-fast-path branch September 2, 2026 11:10
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 area: performance Issues related to performance 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