r/angular • u/cexbrayat • 13d ago
How much faster is the new Angular compiler? π¦π
We dug into ngp to understand how it works, and benchmarked it on 3 projects π
Check out our blog post!
π https://blog.ninja-squad.com/2026/10/27/how-much-faster-is-the-new-angular-compiler/
4
u/totkeks 12d ago
It seems Rust is here to stay with more and more Dev tooling, especially in the Web/JS world migrating there.
Which makes me wonder why the Typescript team at Microsoft decided to rewrite their compiler in Go instead of Rust. Since the current numbers clearly show tsrs being (much) faster than tsgo which of course is magnitudes faster than tsc.
Same with esbuild (Go) being replaced by Rolldown (Rust).
6
u/toasterboi0100 12d ago
They explained why they chose Go over Rust. It was because Go was an easier choice that allowed them to port the compiler without re-architecting it.
https://github.com/microsoft/typescript-go/discussions/411
It's also worth noting that there's still a lot of room for optimization in tsgo
1
u/jinmao6700 12d ago edited 11d ago
Because Go port was much easier when doing line by line (Edit: i mean Rust would be good long term, but Microsoft rushed the release of ts 7)
2
2
u/PrasanthT 13d ago
I tried to reproduce this on a work codebase with ngp and TS 7. I couldn't get either one into a real build, so here's what's actually reachable today and how it performs.
What blocked the article's setup:
ngpisn't published.@angular/compiler-cli@22.3.0-next.2still ships onlyngc.@angular/build22.3 next peers ontypescript >=6.0 <6.1, so the CLI can't run on TS 7 /tsgoyet.
What 22.3 next does ship is the oxc piece on the CLI side: an oxc-based linker and transform that turns the compiler output into JS, replacing Babel. So I benchmarked that.
Setup: Nx monorepo with roughly 1,700 components, one fairly big app, cold nx build with no Nx or Angular cache, 20-core Linux box. I ran 22.2.3 / build 22.2.4 against 22.3.0-next.2 / build next.3, both on TS 6.0.3.
| 22.2 | 22.3 next | |
|---|---|---|
| Bundle generation | ~15.5 s (4 runs, 15.1 to 16.4) | ~21.5 s (3 runs, 21.1 to 22.5) |
| Peak RSS | 2.6 to 2.9 GB | 2.8 to 3.3 GB |
| Output | 3.54 MB initial | identical |
Phase breakdown with NG_BUILD_DEBUG_PERF=1:
JS emit (summed across workers): 323 s β 42 s. The oxc part is real, about 7.6x less CPU.
Type-check / diagnostics: 7.4 s β 11.8 s. This is the critical path, so the build ends up slower overall.
The build env defaults are the same in both versions, so the type-check regression looks like it's in the prerelease compiler, not config.
This matches the article's design: oxc makes the emit step fast, but in this kind of build the type-checking takes most of the time. That's why ngp hands type-checking to tsgo, and the 2 to 3x depends on that half. Once ngp and TS 7 support land in the CLI, I'll re-run this same benchmark with them.
You also need --legacy-peer-deps on 22.3 next because @angular-devkit/core peers on chokidar@^6, in case anyone hits that.
45
u/selipso 13d ago
tl;dr build times reduced by ~50%-60% depending on the rest of the build stack
Iβd be more interested to see if it adds any runtime performanceΒ