Skip to content

perf(@angular/build): avoid loading compiler-cli and typescript in JS transform worker - #34189

Merged
clydin merged 2 commits into
angular:mainfrom
clydin:perf-oxc-linker-logger
Sep 28, 2026
Merged

clydin merged 2 commits into
angular:mainfrom
clydin:perf-oxc-linker-logger

Conversation

@clydin

@clydin clydin commented Sep 28, 2026

Copy link
Copy Markdown
Member

Previously, OxcLinker imported ConsoleLogger and LogLevel directly from @angular/compiler-cli. Even though @angular/compiler-cli/linker is an isolated, lightweight runtime (depending only on semver and convert-source-map), resolving the main @angular/compiler-cli entry point (bundles/index.js) eagerly evaluated the full ngtsc compiler toolchain and required the 10 MB typescript.js bundle at the top level.

As a result, every worker isolate in the JavaScript transformer pool unnecessarily loaded TypeScript and 50+ compiler modules upon bootstrap, incurring ~150 ms of startup CPU latency and allocating ~12 MB of heap per worker thread.

… transform worker

Previously, `OxcLinker` imported `ConsoleLogger` and `LogLevel` directly from
`@angular/compiler-cli`. Even though `@angular/compiler-cli/linker` is an isolated,
lightweight runtime (depending only on `semver` and `convert-source-map`), resolving
the main `@angular/compiler-cli` entry point (`bundles/index.js`) eagerly evaluated
the full `ngtsc` compiler toolchain and required the 10 MB `typescript.js` bundle at
the top level.

As a result, every worker isolate in the JavaScript transformer pool unnecessarily loaded
TypeScript and 50+ compiler modules upon bootstrap, incurring ~150 ms of startup CPU latency
and allocating ~12 MB of heap per worker thread.
@clydin clydin added the target: patch This PR is targeted for the next patch release label Sep 28, 2026
@angular-robot angular-robot Bot added area: performance Issues related to performance area: @angular/build labels Sep 28, 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 replaces the runtime dependency on ConsoleLogger and LogLevel from @angular/compiler-cli with a custom defaultLogger implementation. A review comment suggests improving defaultLogger by ensuring its logging methods respect the configured log level and implementing the debug method properly.

Comment thread packages/angular/build/src/tools/angular/linker/oxc-linker.ts
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Sep 28, 2026
@clydin
clydin requested a review from alan-agius4 September 28, 2026 16:37
@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 28, 2026
@clydin
clydin merged commit 999d84c into angular:main Sep 28, 2026
41 checks passed
@clydin

clydin commented Sep 28, 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-oxc-linker-logger branch September 28, 2026 17:05
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: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants