angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

v7.0.0 bugs and 4/5x slower serve & compile AOT

Open elvisbegovic opened this issue 8 years ago • 100 comments

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

  1. My project have >1200 files.
  2. Before update 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:

3mn => 11% building modules 9/10 modules 1 active ...ojects\i10\src\assets\styles\styles.css and rest steps seems ok It finish in 228737ms

  1. Before update refresh(file edit) it finish in 30seconds and 3th refresh in 25seconds and Now it refresh in 200277ms and 3th refresh in WARNING : 381979ms it is >6 minutes

2. Minimal info of extract i18n

  1. Extract is 3-4 times slower than before update

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...): cli

Environment

Angular CLI: 7.0.1
Node: 10.12.0
OS: win32 x64
Angular: 7.0.0
... common, compiler, compiler-cli, core, forms, http
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.10.1
@angular-devkit/build-angular     0.9.0-rc.3
@angular-devkit/build-optimizer   0.9.0-rc.3
@angular-devkit/build-webpack     0.9.0-rc.3
@angular-devkit/core              7.0.1
@angular-devkit/schematics        7.0.1
@angular/cdk                      6.4.7
@angular/cli                      7.0.1
@angular/material                 6.4.7
@ngtools/webpack                  7.0.0-rc.3
@schematics/angular               7.0.1
@schematics/update                0.10.1
rxjs                              6.3.3
typescript                        3.1.3
webpack                           4.19.1

Others: maybe related to : https://github.com/angular/angular/issues/26572 , https://github.com/angular/angular-cli/issues/12645

@filipesilva heya, sorry to make noise again if you consider this as angular compiler problem(as I think) close or move it please

elvisbegovic avatar Oct 19 '18 09:10 elvisbegovic

@volago can you try the latest @angular-devkit/[email protected] instead please? The version you are using is old.

filipesilva avatar Nov 20 '18 10:11 filipesilva

@filipesilva I've tried with 0.6.8 because it's marked as LTS. Latest (0.10.6) as well as next (0.11.0-rc.0 ) also slows down the build.

volago avatar Nov 20 '18 13:11 volago

@volago is your project somewhere I can look at?

filipesilva avatar Nov 20 '18 13:11 filipesilva

@filipesilva is't private, sorry.

volago avatar Nov 20 '18 13:11 volago

Just hopping in on this. I was getting an error (call_and_retry_last allocation) when I would ng build --prod my project, ng serve and ng build worked fine. The ng build --prod would run forever until it threw this error.

I updated to the latest node.js and turned sourceMap: true to sourceMap: false in both tsconfig.js and angular.json.

Hypenate avatar Nov 23 '18 18:11 Hypenate

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.

inthegarage avatar Nov 27 '18 13:11 inthegarage

Ever since updating to

"@angular-devkit/build-angular": "~0.11.0",
"@angular/cli": "7.1.0"

serve/jit rebuild times got like ten times slower..

(running it with "start:jit": "node --max_old_space_size=16384 ./node_modules/@angular/cli/bin/ng serve")

fxck avatar Nov 28 '18 05:11 fxck

@filipesilva getting ERROR in Internal Error: The structure of the program changed during codegen.. while creating build using ng build --prod. it is working fine for ng build or ng serve. while upgrading my application to angular 7. "@angular/cli": "^7.1.0", "@angular/compiler-cli": "~7.1.0" "@angular/core": "~7.1.0"

angular.json configuration "production": { "optimization": true, "outputHashing": "all", "sourceMap": false, "extractCss": true, "namedChunks": false, "aot": true, "extractLicenses": false, "vendorChunk": false, "buildOptimizer": true, "fileReplacements": [ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.prod.ts" } ] }

jtyagi avatar Nov 28 '18 10:11 jtyagi

Same here

titov-dmytro avatar Nov 28 '18 20:11 titov-dmytro

Just upgraded from 6.0 to 7.1 and build times of both production and incremental became unreasonable. I have opened a separate issue here: #13112 which contains all the relevant data. It seems that I'm now also getting javascript heap as described here: #5618. Can be seen in latest appveyor build: https://ci.appveyor.com/project/IsraelHikingHost/site Should I downgrade back to 6? Does anyone in this thread have an experience with a version that is working as expected?

HarelM avatar Dec 02 '18 06:12 HarelM

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). I really like angular cli and schematics. But build, rebuild and watch times get me crazy.

If it was possible to improve build time with webpack it should be possible to do so with angular-cli, no ?

Thanks

no-more avatar Dec 02 '18 07:12 no-more

@HarelM cli v 7.1 was unbearably slow for me. Reverting to 6.2.8 gave me a drastic improvement

parliament718 avatar Dec 16 '18 01:12 parliament718

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

aalbericio avatar Dec 17 '18 08:12 aalbericio

Also have slower live reloading with angular 7. Was way quicker with angular 6.

matheusdavidson avatar Dec 24 '18 14:12 matheusdavidson

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.

Meligy avatar Dec 25 '18 08:12 Meligy

Just wanted to mention there was a regression in 7.1 (https://github.com/angular/angular-cli/issues/13102), and we have a fix on the way for it.

filipesilva avatar Dec 27 '18 12:12 filipesilva

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): Angular CLI: 7.2.1 Node: 8.11.3 OS: win32 x64 Angular: 7.2.0 ... animations, common, compiler, compiler-cli, core, forms ... language-service, platform-browser, platform-browser-dynamic ... router

Package Version

@angular-devkit/architect 0.12.1 @angular-devkit/build-angular 0.12.1 @angular-devkit/build-optimizer 0.12.1 @angular-devkit/build-webpack 0.12.1 @angular-devkit/core 7.2.1 @angular-devkit/schematics 7.2.1 @angular/cli 7.2.1 @ngtools/webpack 7.2.1 @schematics/angular 7.2.1 @schematics/update 0.12.1 rxjs 6.3.3 typescript 3.2.2 webpack 4.23.1

UPDATE Through trial and error I have discovered my problem is something to do with the IDE I am using, VS Code. When it is closed I can run any ng command, i.e. --version or serve, and it runs as quickly as I expect. When VS Code is open, AND my angular apps folder is opened in it, it slows down again.

Currently debugging trying to pinpoint what VS Code is doing to slow it down.

StuartMc77 avatar Jan 16 '19 12:01 StuartMc77

To be honest I expected terser to require less memory than uglify-es, because of existing bugs that were fixed.

@filipesilva No memory improvement was made in terser over uglify-es. Perhaps in the course of fixing bugs the memory requirement may have actually increased in some cases. If you manage to isolate a terser minify() JS input that has significantly larger memory requirements than uglify-es with the same minify options, put the JS in question into a gist and create a new terser issue.

The one dramatic improvement for the minify time regression in collapse_vars was capping the upper bound of quadratic complexity to save CPU time - not memory.

what can happen is that the inner module closures (the module concatenation thing I mentioned before) managed to get more code in a single module and thus require more memory to optimize, with potential better savings

That's probably what's going on. More code was likely fed to terser in a more recent version of webpack or angular-cli. Perhaps there are webpack dials to limit the size of chunks.

@filipesilva & @kzc Thanks for providing details on this.

Just wanted to know where can we find the webpack dials to check the chunk size.
Shouldnt the size of chunks be limited not to cross node limit, as it cause errors(I agree on the performance reason though).. a more info on the same would help.

Thanks again!

subodhkumar avatar Feb 01 '19 11:02 subodhkumar

With Angular 8 I had the same issue. I updated "@angular-devkit/build-angular": "^0.800.6" to latest "@angular-devkit/build-angular": "^0.801.0" and ng serve build / rebuild times dropped down to what I could call normal (i.e. very quick).

mp54214 avatar Jul 07 '19 15:07 mp54214

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.