angular: serve rebuild speed problem between 9rc.1 and 9rc.2 and 9rc.3
🐞 Bug report
Command (mark with an x
)
- serve
Is this a regression?
Yes, in 9rc1, our app (on serve ivy+aot) each rebuild is <2seconds In 9rc2 app rebuild ~6seconds Now with rc3, if I trigger rebuild by adding one character in file+save (5 times) rebuild always take >15seconds
1.I was on 9rc2 then use ng update
to go to 9rc3 for all packages (cli and core …)
2. After that I run --migrate-only --from=8 --to=9
3. ng s ( ivy and aot is enabled)
🔥 Exception or Error
rebuilt speed problem
See Environment after update/migration
Angular CLI: 9.0.0-rc.3
Node: 13.1.0
OS: win32 x64
Angular: 9.0.0-rc.3
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.900.0-rc.3
@angular-devkit/build-angular 0.900.0-rc.3
@angular-devkit/build-optimizer 0.900.0-rc.3
@angular-devkit/build-webpack 0.900.0-rc.3
@angular-devkit/core 9.0.0-rc.3
@angular-devkit/schematics 9.0.0-rc.3
@angular/cdk 9.0.0-rc.2
@angular/material 9.0.0-rc.2
@ngtools/webpack 9.0.0-rc.3
@schematics/angular 9.0.0-rc.3
@schematics/update 0.900.0-rc.3
rxjs 6.5.3
typescript 3.7.2
webpack 4.41.2
Anything else relevant? cc @filipesilva
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 21 (20 by maintainers)
Correct. The reproduction repo you provided contains some 400 components, which is large enough for the analysis phase to become really noticeable.
Yes, it is still considered blocking.
@elvisbegovic it actually doesn’t make any sense why ngc numbers would be worse the the
ng
/cli numbers. And btw you are correct, not tsconfig(.app).json chance are needed to build the project withngc
.Any chance you could share a project with us that reproduces this behavior? Do you see it on just one particular project or on multiple projects?
We are struggling to understand under what circumstances the rebuild times are this bad, so if you can provide us with any information that would help us reproduce this issue, we’d really appreciate it. thanks!
I used https://github.com/elvisbegovic/ng-speed-rebuild and updated CLI, Material, and Framework to rc.4. Here’s the result of
ng version
:I took rebuilds numbers by adding
console.log(1)
toprojects/one/src/main.ts
after the first build, but discarted the first few rebuilds because they usually take longer.These were the scripts I used. CLI has increased maximum memory since it was very close to the 1.4gb limit.
yarn serve
yarn ngc
We can turn on timing numbers for CLI by editing
node_modules/@ngtools/webpack/src/benchmark.js
to haveconst _benchmark = true;
. When doing so, it’s better to turn off progress reporting viang serve --progress false
too so that the progress messages don’t get in the way of the benchmark logging.I added
--- rebuild triggered ---
markers so it’s clearer what the boundary between rebuilds is.The main thread messages are the ones starting with
AngularCompilerPlugin.
. Most time seems to be spent inloadNgStructureAsync
(~8s).The type checker thread messages are the ones starting with
TypeChecker.
. Most of the time here is spent ingetNgSemanticDiagnostics
(~21s).Comparing these detailed timings from CLI with
ngc
it looks like the CLI has added inneficiencies on type checking since the forked type checker always takes longer than the wholengc
compilation. It is unclear what contributes to theTime for diagnostics
section inngc
though.I can’t share our project. After a lot of work 🥱😫 , I think, I succeed to repro with fresh new project and a lot of duplicates tempaltes (due to i18n in our project) and sometimes a lot of weird templates (I know…) :
In branch
master
is rc3 which rebuild in ~8.5s (check this readme to see measures on this branch) https://github.com/elvisbegovic/ng-speed-rebuild#9-rc3-rebuild-85sIn branch
rc2
is rc2 which rebuild in ~2.9s (check this readme to see measures on this branch) https://github.com/elvisbegovic/ng-speed-rebuild/tree/rc2#9-rc2-rebuild-29s@IgorMinar I didn’t try rc1 but I guess it is even faster to rebuild, I’ll let you do it plz (rc1 in our project it is quick to rebuild).
I hope this is enough to repro.