Web performance
Angular ngp & TypeScript 7.1 Build Performance: Benchmarks, Memory Cuts, and 112 ms Vite HMR
Angular's hybrid Rust/Oxc preprocessor (ngp) in @angular/compiler-cli 22.3.0-next.2 decouples compilation from TypeScript 7's Go compiler (tsgo). Verified Ninja Squad and Push-Based.io benchmarks show 2.0x–2.9x faster cold builds, 50%–76% lower memory usage, and 112 ms template HMR.
8 min read
Angular ngp & TypeScript 7.1 Build Performance: Benchmarks, Memory Cuts, and 112 ms Vite HMR
Executive Summary
Frontend developer velocity and CI pipeline latency directly govern how fast teams ship Core Web Vitals fixes and bundle optimizations. In late 2026, Angular's new hybrid Rust-and-TypeScript compiler preprocessor—ngp (Angular Preprocessor)—entered beta inside @angular/compiler-cli (22.3.0-next.2), designed specifically to unlock TypeScript 7.1 (tsgo) without rewriting Angular's entire template compiler from scratch. Across the official Angular team update, InfoQ's beta coverage, and GhostProgrammer's November 27, 2026 technical breakdown, independent benchmarks confirm dramatic build-time and memory reductions.
For frontend architects and platform engineers running medium-to-large Angular monorepos, the headline telemetry is concrete:
- 2.0×–2.9× faster cold builds: In Ninja Squad's 2-vCPU CI benchmarks, a 1,714-component app dropped from 72.15 s on legacy
ngc(TypeScript 6) to 36.22 s withngp + tsgo + esbuildand 26.43 s withngp + tsrs + Rolldown, while peak RAM fell 50% (from 2.8 GB to 1.4 GB). - 112 ms Vite template HMR (23×–27× faster): Using Push-Based.io's per-file
vite-plugin-ngpprototype on real-world apps (Super Productivityat 252 components andGhostfolioat 157 components), template-edit Hot Module Replacement dropped from 2.6–3.0 s full reloads to 111–112 ms, while dev-server RAM fell 53%–76% (from 3.6 GB down to 1.7 GB and 0.85 GB). - Not production-ready yet:
ngpis still completingngc's Jasmine conformance suite and targets an upcoming Angular 22 minor release once TypeScript 7.1 stabilizes its modular compiler API.
Confidence Level: High for architecture mechanics, compiler pipeline design, and the published Ninja Squad and Push-Based.io benchmark tables cited across InfoQ and GhostProgrammer. Partial visibility applies to final GA Angular CLI numbers: as the Angular team noted on its blog, apples-to-apples Angular CLI production benchmarks—including full bundling, minification, and CSS/asset pipelines—remain pending until TypeScript 7.1 exits beta.
Under the Hood: Why TypeScript 7 Broke ngc & How ngp Works
Since Angular 4.3 (and Ivy in Angular 9), Angular's ahead-of-time compiler (ngc) operated by wrapping tsc in-process. Before emitting JavaScript, ngc constructed a monolithic whole-project ts.Program, ran in-memory template type-checking, and transformed @Component, @Directive, and @Pipe decorators into Ivy runtime instructions (ɵɵ*) via TypeScript's JavaScript ts.Transformer API.
When Microsoft released TypeScript 7.0 (tsgo), rewritten natively in Go for 8–12× raw checking speed, it removed the JavaScript ts.Transformer API (and currently, @angular/compiler-cli releases such as 22.1.2 and 22.2.3 hard-pin typescript >=6.0 <6.1, as documented in angular/angular#69704). Crossing a Go↔JavaScript IPC boundary for every single file's AST transformation would erase Go's performance advantage. Rather than fighting tsgo across an interop bridge, the Angular team decoupled Angular compilation from tsc entirely.
Why Angular Chose Rust + Oxc Over TS 7.1 contentMappers or Go
While frameworks like Vue, Svelte, and Astro adopted TypeScript 7.1's out-of-process contentMappers (tsc --runExternalCode) protocol—and community projects like AnalogJS prototyped streaming virtual .ngtypecheck.ts buffers over tsc --lsp --stdio—the Angular team explained in its September 24 update why ngp went further. Angular performs far deeper AST walking, decorator resolution, and cross-file metadata extraction than single-file template frameworks, so keeping that analysis in JavaScript over an IPC bridge would bottleneck large enterprise builds. Choosing Rust and Oxc over Go gave Angular a mature, MIT-licensed JavaScript/TypeScript parser, semantic binder, and multi-threaded AST engine without waiting for public Go AST libraries in tsgo.
The 3-Stage Hybrid ngp Pipeline
On October 8, 2026, Angular landed the core ngp implementation in a >370,000-line commit containing ~56,000 lines of Rust built on Oxc (VoidZero's Rust parser and AST toolchain powering Vite 8+). Instead of forcing a complete Rust rewrite of Angular's template generator before shipping, ngp splits compilation into three decoupled stages:
flowchart LR
A[".ts + .html Source"] --> B["Stage 1: Rust ng-analyze (Oxc)<br/>Parallel AST & Metadata Extraction"]
B -->|"Metadata Stream"| C["Stage 2: @angular/compiler<br/>Dual In-Memory TS Emission"]
C -->|"component.ng.ts (Ivy ɵɵ*)"| D["Stage 3a: esbuild / Rolldown<br/>Immediate JS Emit"]
C -->|"component.ngtypecheck.ts (TCB)"| E["Stage 3b: tsgo 7.1 / tsrs<br/>Parallel Type-Checking"]- Stage 1 — Parallel Rust Analysis (
ng-analyze+ Oxc): Packaged vianapi-rs(as a native Node addon with a WebAssembly fallback for browser-based IDEs),ng-analyzeparses TypeScript ASTs across CPU cores in parallel, discovers Angular-decorated classes, and resolves component/directive/pipe metadata without building a whole-projectts.Programupfront. - Stage 2 — Dual In-Memory TypeScript Emission (
@angular/compiler): Streams metadata into Angular's existing TypeScript template compiler to emit two in-memory files per source file (with source maps so diagnostics map back to original lines):<file>.ng.ts: Contains runtime Ivy instructions (ɵɵdomElementStart,ɵɵtextInterpolate1, etc.) with clean types that bundlers can strip immediately.<file>.ngtypecheck.ts: Contains synthetic Type Check Block (TCB) functions bound to the component class to preserve 100% of Ivy's strict template type-checking—and never ships in production bundles.
- Stage 3 — Parallel Native Type-Checking & JS Bundling:
esbuildorRolldownstrips types and bundles.ng.tsimmediately without waiting on semantic type-checking, while nativetsgo(TypeScript 7.1) or experimental Rusttsrstype-checks both.ng.tsand.ngtypecheck.tsin parallel.
Benchmarks: Cold Builds, Peak RAM & Vite HMR
Two independent benchmark suites—Ninja Squad (Cédric Exbrayat) on @angular/compiler-cli@22.3.0-next.2 using 2-vCPU CI-like Linux runners, and Push-Based.io (Christopher Holder) testing per-file dev-server compilation with vite-plugin-ngp—quantify the real-world delta between legacy ngc and ngp.
Cold-Build Latency & Memory (Ninja Squad, 2-vCPU Linux)
| App Scale | Legacy ngc (TS 6) |
ngp + tsgo (TS 7.1) + esbuild |
ngp + tsrs + Rolldown |
Peak RAM (ngc → ngp) |
|---|---|---|---|---|
| Small (15 components) | 5.13 s | 1.91 s (2.69× faster) | 1.75 s (2.93× faster) | Lower across all sizes |
| Medium (56 components) | 6.97 s | 3.24 s (2.15× faster) | 2.59 s (2.69× faster) | Lower across all sizes |
| Large (1,714 components) | 72.15 s | 36.22 s (1.99× faster) | 26.43 s (2.73× faster) | 2.8 GB → 1.4 GB (-50%) |
Notice two important nuances in these numbers:
- Why not 10× like standalone
tsgo? Stage 2 (@angular/compiler) still executes in JavaScript/Node.js, and bundling/minification still takes time. Porting Stage 2 template codegen into Rust (building on insights from VoidZero's earlieroxc-angular-compilercollaboration) remains a future optimization runway. - TypeScript 7.1 Beta memory fixes: Compared to TypeScript 7.0.2—which exhibited a memory spike on large repositories—Microsoft's ~48 Go optimizations in TypeScript 7.1 Beta cut checking memory by another 15.8%–49.6% and accelerated type-checking by 1.2×–1.9×.
On-Demand Dev Server & Vite HMR (vite-plugin-ngp, Push-Based.io)
Classic ng serve constructs a whole-program TypeScript graph before serving the first page, causing cold-start latency and RAM consumption to scale linearly with repository size. Per-file ngp compilation breaks that bottleneck:
| Metric | Super Productivity (252 comps) | Ghostfolio (157 comps) | Synthetic 5,000-Comp App |
|---|---|---|---|
| Cold Start to First Page | 10.5 s vs. 17.4 s | 7.5 s vs. 16.3 s | 1.6 s vs. 28.4 s (17.8× faster) |
| Template Edit HMR | 112 ms vs. 2.6 s (23.2×) | 111 ms vs. 3.0 s (27.0×) | — |
| Dev Server RAM | 1.7 GB vs. 3.6 GB (-53%) | 0.85 GB vs. 3.6 GB (-76%) | — |
As Christopher Holder cautioned in InfoQ's coverage, vite-plugin-ngp is currently "a prototype on a prototype" pinned to 22.3.0-next.2, and non-standalone NgModule cross-file optimizations still require careful validation before production rollout.
Diagnostic & Optimization Playbook: Preparing Your Workspace
Do not deploy 22.3.0-next.2 or ngp into production CI/CD pipelines yet. Instead, eliminate the four configuration and architecture blockers that prevent clean per-file compilation so your team can enable ngp in minutes when the Angular 22 minor release ships:
- Upgrade to Angular 20+: If your workspace is still on Angular 16–19, run
ng updateincrementally to reach Angular 20+ before targeting Angular 22. - Finish Standalone Component & Signal Migrations: Standalone components without sprawling
NgModulegraphs sit directly onngp's per-file fast path and avoid cross-module metadata bottlenecks. - Enable
isolatedModulesandverbatimModuleSyntax: Per-file Rust/Oxc transpilation fails fast on ambiguous type re-exports unless they explicitly useexport type { ... }. - Purge Deprecated TypeScript 6
tsconfig.jsonFlags: Options silently tolerated in TypeScript 6—such asbaseUrlandimportsNotUsedAsValues—become hardTS5023build errors in TypeScript 7.
Use this tsconfig.json baseline to test TypeScript 7 & ngp readiness today:
{
"compilerOptions": {
"strict": true,
"target": "ES2026",
"module": "ESNext",
"moduleResolution": "bundler",
"isolatedModules": true,
"verbatimModuleSyntax": true,
"useDefineForClassFields": false
},
"angularCompilerOptions": {
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
Trade-Off Warning: Enabling isolatedModules and verbatimModuleSyntax may surface immediate import/export errors in shared enterprise component libraries (especially barrel index.ts files that re-export interfaces without type). Fix those barrel exports now in CI rather than discovering them during a major Angular/TypeScript bump.
Frequently Asked Questions
What is Angular ngp, and how does it differ from ngc?
ngp (Angular Preprocessor) is Angular's new 3-stage hybrid compiler entering beta in @angular/compiler-cli 22.3.0-next.2. Unlike ngc, which wrapped TypeScript's tsc in-process and relied on the removed ts.Transformer API, ngp uses Rust and Oxc (ng-analyze) for parallel analysis and emits .ng.ts and .ngtypecheck.ts files for downstream native type-checking (tsgo 7.1 / tsrs) and bundling (esbuild / Rolldown).
How much faster is ngp in real-world benchmarks?
In Ninja Squad's 2-vCPU benchmarks, ngp accelerated cold builds by 1.99×–2.69× with tsgo + esbuild and 2.69×–2.93× with tsrs + Rolldown, cutting peak RAM on a 1,714-component app by 50% (2.8 GB to 1.4 GB). In Push-Based.io's vite-plugin-ngp tests, template HMR dropped to 111–112 ms (23×–27× faster) with 53%–76% less dev-server RAM.
Why couldn't Angular 22 use TypeScript 7.0 directly?
TypeScript 7.0 (tsgo) was rewritten in Go and removed the JavaScript ts.Transformer API that ngc depended on, while @angular/compiler-cli@22.x pins typescript >=6.0 <6.1. Calling across a Go↔JS IPC boundary per file would have negated tsgo's speedups, prompting Angular to decouple its preprocessor via ngp.
Can I use ngp in production today?
No. As of late November 2026, ngp is in beta (22.3.0-next.2), still completing ngc's Jasmine conformance suite, and awaiting TypeScript 7.1's stabilized modular compiler API. Full Angular CLI and Language Service integration is targeted for an upcoming Angular 22 minor release.
What tsconfig.json changes should teams make now?
Enable isolatedModules: true and verbatimModuleSyntax: true, remove deprecated TypeScript 6 options (baseUrl, importsNotUsedAsValues, node10 module resolution), migrate remaining NgModules to Standalone Components and Signals, and stay on Angular 20+ to ensure a smooth upgrade.
Sources
- Angular Team (Alex Rickabaugh & Mark Techson) — An update on Angular's TypeScript 7-powered Compiler, Angular Blog, September 24, 2026: https://blog.angular.dev/an-update-on-angulars-typescript-7-powered-compiler-9619a35e2b0a
- GhostProgrammer (Jeffery Miller) — Angular's Rust-Powered Future: How the New ngp Preprocessor and TypeScript 7 Cut Build Times in Half, November 27, 2026: https://www.mymiller.name/wordpress/angular/angular-rust-ngp-preprocessor-typescript-7-build-performance/
- InfoQ (Daniel Curtis) — Angular's TypeScript 7-Powered Compiler Enters Beta with Rust-Based Preprocessor, November 11, 2026: https://www.infoq.com/news/2026/11/angular-compiler-rust-typescript/
- Angular GitHub Issue #69704 — Broader TypeScript peer dependency range for Angular 22, July 8, 2026: https://github.com/angular/angular/issues/69704
- npm (
@angular/compiler-cli) — Package versions & peer dependencies (22.3.0-next.4,22.3.0), November 19, 2026: https://www.npmjs.com/package/@angular/compiler-cli?activeTab=versions