-
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
v7.0.0 bugs and 4/5x slower serve & compile AOT #12646
Comments
@istiti can you try |
@filipesilva not OP, but I'm seeing similar long times with |
@filipesilva main bundle maybe about +0.3mb but maybe this is becasue code size changed... i can't really say it is bigger I find it is not increasing! right I was with I remove package-lock, remove nodes_modules folder, npm i again on this package file |
EDIT: that size difference between this repro and a new project seemed to be the router, so it didn't actually show a regression. Original comment below. @crisbeto provided a reproduction (https://github.com/filipesilva/cli-seven-size-regression) where the size regression can be seen:
Notice the main bundle is 259kB. I tried to make a new project and actually couldn't see the regression, the size was pretty much the same as in v6 (170 vs 173kb):
But since I have a repro I can follow up. |
I confirm On new green project all seems okay @filipesilva |
My main bundle has gone from 1.33MB to 1.59 MB which makes v7 unuseable, 1.3Mb was already on the limit of what's acceptable and can't really afford it to be any bigger. Where has the extra 0.26MB come from? |
@filipesilva The difference between |
Including the router module apparently adds an extra ~3400 (prettified) lines to the main bundle. |
@dottodot I don't know where those extra 0.26 MB come from but I think they hold the answer to this problem. Would you be willing to run some tests for me? The first thing to figure out is if the increased size came from updating Angular itself or the CLI. We can figure that out by updating them separately. By "Angular itself" I mean all By CLI I mean I assume you're doing a production build. Can you tell me the size of the main bundle for these combinations of dependencies please?
This should help narrow down where the size changed. |
@skreborn yeah it took me a while to figure that out, I've edited the original comment to reflect it :/ The size difference must be something else. |
@filipesilva no problem will try and get that info together will be a bit later on though. |
Angular v6 and CLI v6 1.36 MB So I'm assuming that means it's an angular issue rather than cli. |
@dottodot Is the increase in build time similarly noticeable between those versions? |
@crisbeto also reports it happens when updating Angular v6 to v7, while keeping CLI at v7. I'm trying to get to the bottom of it but it's been really hard what a reproduction. If anyone has a project where they see this and can share, it would really help. |
A private project I tried to upgrade did increase in bundle size due to the compiler it looks like being bundled into the production output. I am hoping to try to recreate this is in a isolated small repo. The project is fairly large 60,000+ lines of TS. Here are the images of the webpack bundle analyzer before upgrading to 7 and after. |
Thanks for your clarification, Filipe. Now that we know that this is an expected behavior, I can now be confident in increasing that memory setting. I didn't want to do that before since I always expect new versions to be faster, better and use less memory :) |
@filipesilva No memory improvement was made in The one dramatic improvement for the minify time regression in
That's probably what's going on. More code was likely fed to |
Also keep in mind that one must take into account the aggregate memory consumed by angular-cli, webpack and the minifier. Because the minifier is the last to run it often is blamed for problems occurring in earlier phases of the build pipeline. Webpack had several memory problems related to chunks in the past as I recall. |
@kzc thanks for chiming in, it's always nice to have your uglify insight! I kinda assumed that the memory usage came hand in hand with the CPU consumption since as one gets closer to the memory limit more and more time is spent on garbage collection. But I don't really have the logs of any particular project... source files for these bigger projects is hard to come by. I had a report in #11996 of a 60% reduction in build time when moving to terser though. Maybe that was just the regression you mentioned. Anyway if I come across specific input that exhibits odd resource consumption I'll file an issue. In regards to the aggregate memory usage, we do use the parallel processing in https://github.com/webpack-contrib/terser-webpack-plugin#parallel. This ends up running individual chunks through terser in a separate process, so the overhead from other tooling is reduced. However the chunks are rarely of similar size. Most of the time there's a single huge chunk and several small ones. I think the huge chunk is the one that busts the memory limit. Now that I think about it, I should check if the parent processes memory limit is being passed to the worker processes there... |
Here's an example of a webpack process being very close to the Node heap threshold and a webpack + minifier upgrade just put it over the limit: webpack-contrib/uglifyjs-webpack-plugin#188
True, CPU and memory use are often correlated but minifiers (and probably most optimizing compilers in general) spend the majority of their time looking for optimization opportunities in the AST that may or may not exist. These AST searches don't usually create much in the way of long lived heap objects. Recent V8 versions reportedly have better GC algorithms, but there also could be regressions in some cases. So it would be worth testing different Node versions when encountering a memory issue. |
@volago can you try the latest |
@filipesilva I've tried with |
@volago is your project somewhere I can look at? |
@filipesilva is't private, sorry. |
Just hopping in on this. I updated to the latest node.js and turned sourceMap: true to sourceMap: false in both tsconfig.js and angular.json. |
Instead of the number 8000 (max_old_space_size) being bandied about, our medium sized project needed a value of 16000 to get going. This 1/2ed the time taken for the build. |
Ever since updating to
serve/jit rebuild times got like ten times slower.. (running it with |
@filipesilva getting ERROR in Internal Error: The structure of the program changed during codegen.. angular.json configuration |
Same here |
Just upgraded from 6.0 to 7.1 and build times of both production and incremental became unreasonable. |
Is it not possible to enable cache like cache-loader? Maybe it have already been asked and answered but when I was using webpack + ts-loader + cache-loader + thread-loader I was able to reduce my build time by 3-4 and rebuild time by almost 10. Watch was also greatly improved. I had to switch to angular-cli to benefit AOT witch is not an option (JIT was taking over 30s on an high end computer). If it was possible to improve build time with webpack it should be possible to do so with angular-cli, no ? Thanks |
@HarelM cli v 7.1 was unbearably slow for me. Reverting to 6.2.8 gave me a drastic improvement |
I'd like to ask a little question regarding the future... What is the expected impact of Webpack 5 in this issue? Is there any numbers Google can share on this? Thanks |
Also have slower live reloading with angular 7. Was way quicker with angular 6. |
Has anyone checked if the situation is different with Bazel running the compilation? As explained by @mgechev in his post Introducing Bazel Schematics for Angular CLI. |
Just wanted to mention there was a regression in 7.1 (#13102), and we have a fix on the way for it. |
Has anyone got a definite fix for this yet? I created a new Angular 7 project (version details below) and running any ng commands while in the app folder is taking a ridiculous about of time, for example, running "ng --version" outside the app folder takes about 5 seconds, running it INSIDE the app folder took around 10 minutes. VERSION DETAILS (ng --version): Package Version@angular-devkit/architect 0.12.1 UPDATE Currently debugging trying to pinpoint what VS Code is doing to slow it down. |
@filipesilva & @kzc Thanks for providing details on this. Just wanted to know where can we find the webpack dials to check the chunk size. Thanks again! |
With Angular 8 I had the same issue. I updated "@angular-devkit/build-angular": "^0.800.6" |
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. |
I hesitate to open this issue on angular page. I opened same issue title 2 week ago here without AOT : v7.rc.0 serving 2x - 3x slower than stable versions on my projects after moving to angular 7.0.0 all is slower (jit seems OK)
I'm submitting a...
[ x ] Performance issue
[ x ] Bugs
Current behavior
All was OK with cli7rc3 and angular 6.1.10
This morning after updating to angular 7.0.0 serving with JIT is ok but serving with AOT or build my application or generating i18n xmb file is 2-3 times slower
Expected behavior
Get build/extract i18n time like with cli7rc3 and angular 6.1.10
1. Minimal info of AOT serving
node --max-old-space-size=8192 ./node_modules/@angular/cli/bin/ng serve --aot --sourceMap=false --disableHostCheck --port=4200
first build finish in 45seconds and Now blocking:2. Minimal info of extract i18n
Here is my angular.json config file
I tried debug with ndb and share my profile data with
ng s --aot
but it seems not work ndb crash ( disk is highly used...):Environment
Others:
maybe related to : angular/angular#26572 , #12645
@filipesilva heya, sorry to make noise again if you consider this as angular compiler problem(as I think) close or move it please
The text was updated successfully, but these errors were encountered: