-
Notifications
You must be signed in to change notification settings - Fork 12k
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
1.5 AOT by default performance tracking issue #8259
Comments
@filipesilva thanks to this I will do it right now ! cant wait 40 seconds after each changes :(
|
@filipesilva it take ~8 seconds see https://drive.google.com/file/d/0B5h6RmZbETX3WUJYR0JwM3RnZnc/view?usp=sharing |
@aitboudad thanks for posting your profile here! I can get some information out of it but it looks very different from others I've seen.... What node version are you using? Wondering if it's related to that. |
I took a CPU profile of a rebuild from @karptonite's project in #8216 (with his permission). It looks like this: It can be found here: https://drive.google.com/file/d/0B06an8Bxmi7UWTBOUHY4SVRWNkE/view?usp=sharing The interpretation of that CPU profile is that the big chunks on the middle/left (the ones that say I'm going to talk to the compiler team to see if something can be done about the |
@istiti thanks for doing this. 40s is really a long time for a rebuild, can you try using |
@filipesilva thanks for theses clear/easy steps but just to be more precise without error/question you should edit your message to have : and edit step "You should see a chart" because I see : And I edit 3 times main.ts writing at end : and last one writing Here's my config :
And file: https://drive.google.com/open?id=0BzKW4KaSm_QMQXpUWlpmeFh4RVk please apologizes my ignorance, cant able to read this profile, outside of my skills :) UPDATE: change npm version was write mistake above |
@istiti thank you so much for this information, I'll edit my comment to reflect the memory flag and the view selector. Your CPU profile looks a lot like @karptonite's one. Most of the time is spent in emitting files from |
@filipesilva what does this mean, it's on angular side?? do you invite me to make some noises here angular/angular#19337 |
|
@istiti not necessarily. The CLI might be using the compiler incorrectly and that results in bigger build times. So I have to investigate what's the root cause of the problem, I do not know yet. |
@filipesilva downgraded my node version into |
@aitboudad ah yes, it seems it was because of the node version... now it looks like the others: |
@filipesilva here is my screenshot: Here is my config:
|
@zeniale thanks for pitching in. Yours is a bit different from the rest... it seems that half the time is spent on rebundling. Just to confirm, do you remember which rebuild number this was? The first 2 or 3 rebuilds could do this but I wouldn't expect the ones after that. |
@filipesilva I followed your instructions, this is the fourth (4) rebuild |
Thanks for the confirmation. Then in yours I see around 33s used in AngularCompilerProgram and 20s in webpack rebundling, for a total of a 70s rebuild. Can you tell me how long are your |
No AOT: 500-700ms Profile: https://drive.google.com/open?id=0B-z04hg-_QmgTmloU0VNSzBZVkE |
Is everyone counting rebuilds the same way? That is, does the first "build" count as a rebuild, or is it a rebuild only when after the first change? |
@karptonite following the instructions in the original post should yield a CPU profile for the fourth rebuild. Any rebuild after the second or third should be fine however. |
@filipesilva If I launch --no-aot build, I get some errors like this:
This error in repeated for many modules. This seems to be this BUG (#8263) or this (#8066). This error is also present when launching |
@filipesilva I get the error after compilation, I generate .cpuprofile file & screenshot for P.S. Can you notify me on previous error solution? |
@filipesilva I really want help you here and give you more infos from my project, how can I help to investigate? IMHO on more common project angular-cli 1.5.0 can't sell and activate aot by default |
Besides just trying to make AoT compilation faster, which is good, of course, why not try to come up with ways to make the compilation faster by avoiding certain patterns or using certain features in a different way. For example, in the past it has been mentioned that using barrels could hurt performance. Is that still the case? Always or only when using How about path alises, do they hurt rebuild times? And inline templates vs separate files? Inline styles vs scss files? And what about having some output in the console with the number of modules contained in a chunk so we can more easily work towards having chunks with less modules (just looking at file size is tricky). |
To answer your questions:
It's also breaking ours. We really pushed the limits of both compilers (
Yes and no. We have a plan to remake the build system which will allow us to keep using webpack while also splitting your application in smaller pieces. When that's in, you should see shorter rebuild times (assuming you're following our best practices).
Not yet, but this is something we're working on.
It is still the case, but we helped webpack improve on this and they're still improving. We now build CommonJS in development which also fixes this issue completely (we want to go back to ES2015 modules but won't until performance improves). In this case though, the performance itself comes from generating factories. The barrel is not a factor anymore, so times reported in this issue come mostly from
No. Path aliases are done by typescript, and report times of typescript itself (which is used in JIT) is minimal. Path aliases happen in both JIT and AOT.
This is where most of the time is being spent in The real fix would be to have smaller applications, which will come in the new build system and ABC (when it's ready). |
"It's also breaking ours. We really pushed the limits of both compilers (webpack, ngc and tsc) to be able to set AOT by default, and we fell short on large projects." |
Any temporary workaround? |
@theunreal You can still use |
@hansl @filipesilva With all this discussion on making aot default, I didn't see any info about running unit tests in aot. Will that be a possibility in the future? Will |
Here's one from me if it's still required. It's a pretty hefty project with a lot of work poured in it, and the profile is on Node v8.7.0 with the versions of Angular and the CLI noted above on a beefy Macbook Pro. |
Here is an interesting profile from our project, which takes 128 seconds on the 3rd rebuild while debugging. Almost 2 minutes are spent in Note that this was using Typescript 2.5.3 instead of the suggested 2.4.x. We are also using https://github.com/mseemann/angular2-mdl which might be introducing some hard to analyze/generate styles. Or maybe we are just doing something else in our codebase which the AoT compiler doesn't like. |
Since most of the time is spent on |
@danwulff there's some discussion about AOT in unit tests on #8007 @diagramatics thanks for taking your CPU profile as well. I had a look at it and it looks very similar to the 'normal' time distribution: 3/4s on AOT, 1/4 on webpack. It's good to get confirmation of these samples 👍 @hccampos I pinged the compiler team about your issue. |
@filipesilva looks like there is a confusion between |
@pleerock thanks for heads up, will edit it. |
Will aot be default on ng serve as promised for v6? |
Where is it promised?! afaik it was for 1.5 but not interesting on large project. I heart for v6.x some things about it will come but still’ not default You could take a look inside bazel from alexeagle repo or https://www.ng-conf.org/sessions/hands-full-stack-development-nx-bazel/ |
Not directly promised for this release but mentioned in the angular 5
release:
https://blog.angular.io/version-5-0-0-of-angular-now-available-37e414935ced
Begović <[email protected]> schrieb am Mo. 16. Apr. 2018 um 21:29:
… Where is it promised?! afaik it was for 1.5 but not interesting on large
project. I heart for v6.x some things about it will come but still’ not
default
You could take a look inside bazel from alexeagle repo or
https://www.ng-conf.org/sessions/hands-full-stack-development-nx-bazel/
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#8259 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQ8j8jXBobtMB-SerPJNqHra7caHbLr3ks5tpPD_gaJpZM4QMhfl>
.
|
Yes, if you read in this thread this comment it was by default one moment but deactivated again because in my project by example it is completly not interesting. check my comment here. And last news you can read this comment |
Thx I was looking for this.
Begović <[email protected]> schrieb am Mo. 16. Apr. 2018 um 22:46:
… Yes, if you read in this thread this comment
<#8259 (comment)>
it was by default one moment but deactivated again
<filipesilva@211bc3a>
because in my project by example it is completly not interesting. check
my comment here
<#8259 (comment)>
.
And last news you can read this comment
<#10304 (comment)>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#8259 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQ8j8okegd7ixvsgFJ44A2fj09q5BQ_Pks5tpQM1gaJpZM4QMhfl>
.
|
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. |
Heya all,
When using Angular CLI 1.5 together with Angular 5.0.0,
ng serve
will default to using--aot=true
. We added a new pipeline that should make AOT compilation much faster than it was with older CLI and Angular versions so we felt confident that AOT rebuild speeds should be much better.Bigger projects can still have slow AOT rebuilds though. You can disable AOT by passing on the
--no-aot
(or--aot=false
) flag, but if you have time I'd also like to ask for your help debugging remaining bottlenecks.A good way to figure out how time is being spent in a rebuild is via CPU profiles. These show what functions are being called and how much time is being spent in each function.
This is how you can capture a CPU profile and share it here:
@angular/[email protected]
.@angular/[email protected]
, together with other@angular/*
packages.[email protected]
.[email protected]
, newer versions might work but this is the latest officially supported by@angular/compiler-cli
.chrome://inspect/#devices
in chrome, and then clickOpen dedicated DevTools for Node
. This will give you a window calledDeveloper Tools - Node.js
that we'll get back to in a second.package.json
, add the following NPM script:"debug": "node--max_old_space_size=8192 --inspect --debug-brk ./node_modules/@angular/cli/bin/ng serve"
npm run debug
.Open dedicated DevTools for Node
window should pop up. It is stopped on the very first line of Angular CLI. Click theResume
button in the upper left corner of that window:main.ts
file, addconsole.log(1);
to the end of it and save. Do this 3 times.console.log
.Open dedicated DevTools for Node
window.Profiler
.Start
.console.log(1);
tomain.ts
and save it.Stop
button in the profiler tab.Profile 1
shows up on the left, and then click it (opening it can take some time for big projects).If you don't see a chart, click the dropdown beneath
Profiler
and selectChart
from there.This is how it looks like for a new project:
Profile 1
, clickSave
. Upload it somewhere and link it here.Then I can look at the CPU profile and see where time is being spent on your rebuild. Hopefully I can find new bottlenecks and make your builds faster.
Note: Sometimes the debugger doesn't disconnect after you quit the
ng serve
process. If you have to do this process more than once and getUnable to open devtools socket: address already in use
when runningnpm run debug
, open your process manager and kill any existingNode.js
processes.The text was updated successfully, but these errors were encountered: