NGC rebuild performance improvements (Ivy & AoT)
See original GitHub issueš feature request
Relevant Package
This feature request is for @angular/compiler-cli
Description
Thanks to the team my issue https://github.com/angular/angular/issues/33986 was fixed in 9rc4 build.
I open this feature request to ask (prioritize) others impovements regarding ngc rebuild
, actually in large project 8-15s rebuild (on each file change) is pretty long.
Repro
I think I succeed to repro a rebuild slowness by multiply by 2 the number of components (now 817) in my last issue repro ng-speed-rebuild
Clone master
branch, create ngcc
ivy entry points, run npm run ngc
to start the project.
Hereās ngc-9rc9.cpuprofile of an isolated rebuild of the repro.
Describe the solution youād like
Out of scope to me. From what Iāve learned/heard the long phase is: emitting and reparse all components on each rebuild
Describe alternatives youāve considered
- I tried on two differents hardware (VM ubuntu & win10) rebuild time is pretty same.
- I canāt be sure if ng-speed-rebuild repro is reflecting our private project because we have a lot of imports/exports/shared components. On our private project we have 850 components, if it can help here you are a
.cpuprofile
of an isolated ngc rebuild of our private project private-project-ngc-9rc9.cpuprofile - NOTE: With CLI 9rc9
ng serve
rebuild is weird and really longer https://github.com/elvisbegovic/ng-speed-rebuild#ng-serve-9rc9-rebuild--83s---7s---5s---15s---17s---14s
Other
Might be related to https://github.com/angular/angular/issues/34796 (wait repro)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:12
- Comments:6 (5 by maintainers)
@elvisbegovic thank you so much for the reproduction! These kinds of examples are invaluable in diagnosing performance issues. Iāve already found a couple interesting issues from this repo:
The way we implement template type-checking triggers āsafe modulesā reuse in TypeScript, which is slower than ācompleteā program reuse. I have an idea for how to avoid this, which Iāll play around with.
In this repo, during incremental build steps TypeScript does reports that a number of
.d.ts
files have changed between builds (obviously this isnāt the case). This causes us to deopt and not reuse any parts of Angular analysis or previous emit results. Itās a huge performance hit and is only marginally faster than a full fresh build. Ouch.The dependency graph seems to require the re-emit of all the components when the one you suggested is changed anyway. This seems excessive, and I need to dig into why the graph is shaped as such. Perhaps thereās room for improvement here.
Iāll dig into these. Thanks!
Hey guys, this seems cool.
Click here to see stats/diff between Angular 11.2.1 VS 11.2.6 on Google Sheet NGC profiles Click here to download isolated .cpuprofile of a rebuild on Angular 11.2.1 Click here to download isolated .cpuprofile of a rebuild on Angular 11.2.6 NG SERVE profiles .cpuprofile of a rebuild on ng serve11.2.5 NO sourcemap .cpuprofile of a rebuild on ng serve11.2.5 WITH sourcemap{scripts,styles}
cc/ @JoostK