Skip to content

perf(@angular/build): enable fast-path AST printing with sourcemaps in AotCompilation#33526

Open
clydin wants to merge 1 commit into
angular:mainfrom
clydin:perf/fast-path-sourcemaps
Open

perf(@angular/build): enable fast-path AST printing with sourcemaps in AotCompilation#33526
clydin wants to merge 1 commit into
angular:mainfrom
clydin:perf/fast-path-sourcemaps

Conversation

@clydin

@clydin clydin commented Jul 7, 2026

Copy link
Copy Markdown
Member

Previously, when sourcemaps were enabled, AotCompilation was forced to run the full, slow TypeScript compilation/emit path (useTypeScriptTranspilation = true) because the standard ts.createPrinter().printFile method does not support generating sourcemaps.

This commit leverages TypeScript's internal createTextWriter, createSourceMapGenerator, and printer.writeFile APIs to generate sourcemaps directly during AST printing.

This allows AotCompilation to use the fast AST transformation and printing path even when sourcemaps are enabled (as long as isolatedModules is true), drastically improving rebuild performance for dev server builds.

@clydin clydin added the target: minor This PR is targeted for the next minor release label Jul 7, 2026
@angular-robot angular-robot Bot added area: performance Issues related to performance area: @angular/build labels Jul 7, 2026
@clydin clydin force-pushed the perf/fast-path-sourcemaps branch 4 times, most recently from 8e4d95f to 480d884 Compare July 7, 2026 20:10
…n AotCompilation

Previously, when sourcemaps were enabled, AotCompilation was forced to run the full, slow TypeScript compilation/emit path (`useTypeScriptTranspilation = true`) because the standard `ts.createPrinter().printFile` method does not support generating sourcemaps.

This commit leverages TypeScript's internal `createTextWriter`, `createSourceMapGenerator`, and `printer.writeFile` APIs to generate sourcemaps directly during AST printing.

This allows AotCompilation to use the fast AST transformation and printing path even when sourcemaps are enabled (as long as `isolatedModules` is true), drastically improving rebuild performance for dev server builds.
@clydin clydin force-pushed the perf/fast-path-sourcemaps branch from 585f0c5 to fe96bc9 Compare July 7, 2026 23:38
@clydin clydin marked this pull request as ready for review July 8, 2026 00:52
@gemini-code-assist

Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jul 8, 2026
@clydin

clydin commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist

This comment was marked as duplicate.

@clydin clydin requested a review from alan-agius4 July 8, 2026 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer 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.

1 participant