-
Notifications
You must be signed in to change notification settings - Fork 25.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular 12.1.0 big rebuild time #42799
Comments
I wonder if this the same as angular/angular-cli#21116 which was determined to be an issue in the TypeScript compiler. Can you check if you get similar results running TSC directly.
|
Same changes in AppComponent, nothing commented out ( Also you can see low results for the |
Could you please also run 11 without The Ivy build pipeline is doing incremental type-checking, instead of offloading it to a different worker. From your profile however I notice that type-checking of templates have to be redone. This might be due to a path normalization issue on Windows, where the cached template diagnostics are missed and therefore recomputed. Additionally, what is strange is that the profile is showing that program structure could not be reused. Was this perhaps the first rebuild? That would explain why no program reuse was available and also why template type-checking had to be redone (the initial rebuild is tainted because of how template type-checking is done, preventing program reuse and it invalidates prior type-check results) |
There are 3-4 rebuilds starting with the second one for each case before getting average value. First rebuild in ng12 is roughly the same as the following ones, first one in ng11.1.2 with NG_BUILD_IVY_LEGACY=1 is 4-5 times slower (100s vs 14s following)
same issue has my colleague with MacOS for the same project (asked him to recheck tomorrow and to record cpu profile for the
ng 11.1.2, default case, NG_BUILD_IVY_LEGACY=0
also noticed a huge memory consumption ~6.2gb for first rebuild and ~7.1gb for the second (looks like all free memory). Same for ng12 rebuilds - uses up to all available memory (started with |
It seems very similar to angular/angular-cli#21228 , is possible that you have tailwindcss@2.2.4 in your project? |
nope, regular scss styling, default cli serve (no webpack config customization), ~300-400 images required with |
cpu profile of 4th rebuild, |
Could you set Note: the flag does not have an effect when used with the CLI, only using the |
Server started{
"events": {
"InputDtsFile": 1759,
"InputTsFile": 10517,
"AnalyzeComponent": 1682,
"AnalyzeDirective": 77,
"AnalyzeInjectable": 687,
"AnalyzeNgModule": 559,
"AnalyzePipe": 47,
"TraitAnalyze": 3052,
"GenerateTcb": 1682,
"UpdateTypeCheckProgram": 1,
"EmitSourceFile": 5374
},
"phases": {
"Unaccounted": 2149638,
"Setup": 1452,
"TypeScriptProgramCreate": 14520731,
"TypeScriptDiagnostics": 16945268,
"Analysis": 6057360,
"Resolve": 1093654,
"CycleDetection": 135902,
"TcbGeneration": 3850441,
"TcbUpdateProgram": 3214251,
"TypeScriptEmit": 15904762,
"Compile": 4737047,
"TtcDiagnostics": 8363886
},
"memory": {
"Initial": 71360216,
"TypeScriptProgramCreate": 577769256,
"Analysis": 1347536192,
"Resolve": 1363283944,
"TtcUpdateProgram": 1831566080,
"PreEmit": 1989555840,
"Emit": 2415238888
}
} First rebuild{
"events": {
"InputDtsFile": 1759,
"InputTsFile": 10517,
"AnalyzeComponent": 1682,
"AnalyzeDirective": 77,
"AnalyzeInjectable": 687,
"AnalyzeNgModule": 559,
"AnalyzePipe": 47,
"TraitAnalyze": 3052,
"GenerateTcb": 1682,
"UpdateTypeCheckProgram": 1,
"EmitSourceFile": 5374
},
"phases": {
"Unaccounted": 73803,
"Setup": 115024,
"TypeScriptProgramCreate": 7789981,
"Reconciliation": 17248,
"TypeScriptDiagnostics": 16368127,
"Analysis": 5063386,
"Resolve": 1461536,
"CycleDetection": 252679,
"TcbGeneration": 4182421,
"TcbUpdateProgram": 2983010,
"TypeScriptEmit": 13762470,
"Compile": 4761262,
"TtcDiagnostics": 8074679
},
"memory": {
"Initial": 1620269440,
"TypeScriptProgramCreate": 1720257688,
"Analysis": 2285657080,
"Resolve": 2178945408,
"TtcUpdateProgram": 2627735968,
"PreEmit": 2780433640,
"Emit": 2759891536
}
} Second rebuild{
"events": {
"InputDtsFile": 1759,
"InputTsFile": 10517,
"AnalyzeComponent": 1682,
"AnalyzeDirective": 77,
"AnalyzeInjectable": 687,
"AnalyzeNgModule": 559,
"AnalyzePipe": 47,
"TraitAnalyze": 3052,
"GenerateTcb": 1682,
"UpdateTypeCheckProgram": 1,
"EmitSourceFile": 5374
},
"phases": {
"Unaccounted": 87090,
"Setup": 20138,
"TypeScriptProgramCreate": 7773523,
"Reconciliation": 24136,
"TypeScriptDiagnostics": 15853157,
"Analysis": 4532055,
"Resolve": 975659,
"CycleDetection": 141955,
"TcbGeneration": 3536365,
"TcbUpdateProgram": 2478772,
"TypeScriptEmit": 12085801,
"Compile": 3330321,
"TtcDiagnostics": 7736459
},
"memory": {
"Initial": 2762701880,
"TypeScriptProgramCreate": 2861967504,
"Analysis": 2445319304,
"Resolve": 2449485656,
"TtcUpdateProgram": 2886851304,
"PreEmit": 3059858832,
"Emit": 3411603528
}
} Third rebuild{
"events": {
"InputDtsFile": 1759,
"InputTsFile": 10517,
"AnalyzeComponent": 1682,
"AnalyzeDirective": 77,
"AnalyzeInjectable": 687,
"AnalyzeNgModule": 559,
"AnalyzePipe": 47,
"TraitAnalyze": 3052,
"GenerateTcb": 1682,
"UpdateTypeCheckProgram": 1,
"EmitSourceFile": 5374
},
"phases": {
"Unaccounted": 80811,
"Setup": 17180,
"TypeScriptProgramCreate": 7958840,
"Reconciliation": 10814,
"TypeScriptDiagnostics": 14910830,
"Analysis": 4866759,
"Resolve": 1037635,
"CycleDetection": 127137,
"TcbGeneration": 3612529,
"TcbUpdateProgram": 2565787,
"TypeScriptEmit": 12319332,
"Compile": 3264253,
"TtcDiagnostics": 7595661
},
"memory": {
"Initial": 3400710728,
"TypeScriptProgramCreate": 3495610032,
"Analysis": 4120582984,
"Resolve": 4135344448,
"TtcUpdateProgram": 4566947992,
"PreEmit": 4743617952,
"Emit": 5093426736
}
} |
I think I have an idea for where the remaining time comes from. The template type checker may need to add type-checking code to user code, if the same effect cannot be achieved from within the type-check file (e.g. when a directive has an internal generic type, it cannot generate the type constructor external to the directive). If this adds imports to the file, the program structure cannot be reused and also incremental type-checking is not as effective, as imports affect the computed shape. This incurs significant costs on program creation and type-checking time. |
Maybe this blog by @brandonroberts can be helpful. https://dev.to/brandontroberts/speeding-up-the-development-serve-after-upgrading-to-angular-v12-5db5 |
Is not related to our issues. Already have these config after regular ng migration command |
I have been doing some experiments with the repo I typically use for perf issues, but this does not reproduce for me. I have forced the usage of inline type constructors but then #42759 is sufficient to mitigate the performance issues (that PR will be in this week's release). I'm afraid that without a reproduction we can run locally this isn't actionable at the moment. |
@artaommahe did you find any solution? hugely slow |
@pichuser nope, dunno what to debug. Still 16s to rebuild main.ts for a big project |
Hi @artaommahe can you check the fix in the last comment of #20792. CC: @JoostK, @alan-agius4 |
|
@artaommahe, I noticed that you are using |
and
haven't helped at all. Same ~16s for second+ rebuild of main.ts file
🤦♂️ forgot to replace... Fixed it - nothing changed :( ng 12.1.3 Just tried ng 12.2.1 - same 16s 😕 |
@artaommahe, unfortunately as @JoostK mentioned without a reproduction, even shared privately it will not be possible to get to the bottom of this. |
@alan-agius4 as i said in first post - i can debug anything or provide teamviewer access. Discord tag is also there. |
Closing as obsolete - please feel free to reopen if you're still experiencing pathological slowness with v13.2+ |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
Command (mark with an
x
)Is this a regression?
It was much faster for rebuilds with ng11.1.2 + NG_BUILD_IVY_LEGACY=1 (see the table below).
Description
Rebuild time for AppComponent changes (adding console.logs) increase drastically with the amount of code.
We have relatively big application. Here are some measures for starting server and rebuilding on changes in AppComponent for different cases.
(ng11 - 11.1.2 version with NG_BUILD_IVY_LEGACY=1)
(all changes are adding console.log() statements to AppComponent, median of 3-4 passes excluding first on)
🔬 Minimal Reproduction
Don't have a public reproduction. Attaching rebuild performance profiling for
18 of 24 lazy routes disabled
case.CPU-20210707T141946.cpuprofile
https://drive.google.com/file/d/1LQzweIGTErNLmjcLhDjnGOSWiVbol-gR/view?usp=sharing
Cant profile the
default
case with all routes enabled - chrome crashes trying to dump all this stuff :(🔥 Exception or Error
🌍 Your Environment
Anything else relevant?
This issue affects several of our projects relatively same size. Most of our code is inside
libs/
subfolders and is imported directly by sources (nrwl/nx like monorepo).Can debug something else, share screen or provide TeamViewer access to our codebase to check anything (discord drow#4335)
The text was updated successfully, but these errors were encountered: