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

Rebuild extremely slow

Open asadsahi opened this issue 10 years ago • 226 comments

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Windows 10

  2. Versions. Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here: angular-cli: 1.0.0-beta.11-webpack.8 node: 6.3.0 os: win32 x64

  3. Repro steps. Was this an app that wasn't created using the CLI? What change did you do on your code? etc. app created with 1.0.0-beta.11-webpack.2 and later on upgraded to 1.0.0-beta.11-webpack.8 with appropriate changes.

  4. The log given by the failure. Normally this include a stack trace and some more information. The slow behavious is observed when upgraded from 1.0.0-beta.11-webpack.2 to 1.0.0-beta.11-webpack.8

  5. Mention any other details that might be useful. Slow behavious reproduceable in following repo: https://github.com/asadsahi/ng2fb-bootstrap


I have experience this on two operating systems, windows 7 and windows 10. Has anyone else experieced this? For me rebuilds are dramatically slow, taking roughly 7-8 seconds which on same machine with cli version webpack.2 was taking rougly 2-3 seconds.

asadsahi avatar Sep 05 '16 10:09 asadsahi

On windows, performance boost is even more significant, as not to say astronomic:

My rebuild times: beta26: around 15s.. beta28: under 1s-2s. (!)

Really great job, guys!

hnrchrdl avatar Feb 02 '17 09:02 hnrchrdl

But now I realize, Webpack Dev Server keeps saying, nothing has changed, when in fact things have changed. Changes are not beeing picked up correctly. Am I missing something, or is this a new issue? When I quit devserver and ng serve again, changes are beeing picked up, automatic rebuild says "Nothing has changed" in the browser's console. So it recognises that a file has been saved, but sees no difference. Changes in the html templates are considered, changes in my typescript files are not.

hnrchrdl avatar Feb 02 '17 10:02 hnrchrdl

There is an open issue appeared with beta 28: https://github.com/angular/angular-cli/issues/4338

ClemensSchneider avatar Feb 02 '17 10:02 ClemensSchneider

Ok, I could fix that (with the fix of beeman described in #4329). But now, rebuild times are back at 15s with beta 28 on windows 7.

hnrchrdl avatar Feb 02 '17 10:02 hnrchrdl

Great job!

From 2s-4s time to 300-600ms

Laurensvdmaas avatar Feb 03 '17 12:02 Laurensvdmaas

Massive improvement for me on Windows 10

beta26: ~12s beta28: ~2s

Thanks!

szilarddavid avatar Feb 04 '17 08:02 szilarddavid

While it's better with the new cli, here it is...

webpack: bundle is now VALID.
webpack: bundle is now INVALID.
Hash: 4e3ed080d33362fa5a97                                                         
Time: 14510ms
chunk    {0} 0.chunk.js, 0.bundle.map 2.82 MB {1} {2} {3} {4} {6} [rendered]
chunk    {1} 1.chunk.js, 1.bundle.map 2.81 MB {0} {2} {3} {4} {6} [rendered]
chunk    {2} 2.chunk.js, 2.bundle.map 2.24 MB {0} {1} {3} {4} {6} [rendered]
chunk    {3} 3.chunk.js, 3.bundle.map 2.66 MB {0} {1} {2} {4} {6} [rendered]
chunk    {4} 4.chunk.js, 4.bundle.map 1.32 MB {0} {1} {2} {3} {6}
chunk    {5} polyfills.bundle.js, polyfills.bundle.map (polyfills) 418 kB {9} [initial]
chunk    {6} main.bundle.js, main.bundle.map (main) 143 kB {8} [initial] [rendered]
chunk    {7} styles.bundle.js, styles.bundle.map (styles) 412 kB {9} [initial]
chunk    {8} vendor.bundle.js, vendor.bundle.map (vendor) 4.72 MB [initial]
chunk    {9} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry]
webpack: bundle is now VALID.
webpack: bundle is now INVALID.
Hash: 4e3ed080d33362fa5a97                                                         
Time: 6314ms
chunk    {0} 0.chunk.js, 0.bundle.map 2.82 MB {1} {2} {3} {4} {6}
chunk    {1} 1.chunk.js, 1.bundle.map 2.81 MB {0} {2} {3} {4} {6}
chunk    {2} 2.chunk.js, 2.bundle.map 2.24 MB {0} {1} {3} {4} {6}
chunk    {3} 3.chunk.js, 3.bundle.map 2.66 MB {0} {1} {2} {4} {6}
chunk    {4} 4.chunk.js, 4.bundle.map 1.32 MB {0} {1} {2} {3} {6}
chunk    {5} polyfills.bundle.js, polyfills.bundle.map (polyfills) 418 kB {9} [initial]
chunk    {6} main.bundle.js, main.bundle.map (main) 143 kB {8} [initial]
chunk    {7} styles.bundle.js, styles.bundle.map (styles) 412 kB {9} [initial]
chunk    {8} vendor.bundle.js, vendor.bundle.map (vendor) 4.72 MB [initial]
chunk    {9} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry]
webpack: bundle is now VALID.
webpack: bundle is now INVALID.
Hash: 4e3ed080d33362fa5a97                                                         
Time: 5401ms
chunk    {0} 0.chunk.js, 0.bundle.map 2.82 MB {1} {2} {3} {4} {6}
chunk    {1} 1.chunk.js, 1.bundle.map 2.81 MB {0} {2} {3} {4} {6}
chunk    {2} 2.chunk.js, 2.bundle.map 2.24 MB {0} {1} {3} {4} {6}
chunk    {3} 3.chunk.js, 3.bundle.map 2.66 MB {0} {1} {2} {4} {6}
chunk    {4} 4.chunk.js, 4.bundle.map 1.32 MB {0} {1} {2} {3} {6}
chunk    {5} polyfills.bundle.js, polyfills.bundle.map (polyfills) 418 kB {9} [initial]
chunk    {6} main.bundle.js, main.bundle.map (main) 143 kB {8} [initial]
chunk    {7} styles.bundle.js, styles.bundle.map (styles) 412 kB {9} [initial]
chunk    {8} vendor.bundle.js, vendor.bundle.map (vendor) 4.72 MB [initial]
chunk    {9} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry]
webpack: bundle is now VALID.
webpack: bundle is now INVALID.
Hash: 4e3ed080d33362fa5a97                                                         
Time: 5380ms
chunk    {0} 0.chunk.js, 0.bundle.map 2.82 MB {1} {2} {3} {4} {6}
chunk    {1} 1.chunk.js, 1.bundle.map 2.81 MB {0} {2} {3} {4} {6}
chunk    {2} 2.chunk.js, 2.bundle.map 2.24 MB {0} {1} {3} {4} {6}
chunk    {3} 3.chunk.js, 3.bundle.map 2.66 MB {0} {1} {2} {4} {6}
chunk    {4} 4.chunk.js, 4.bundle.map 1.32 MB {0} {1} {2} {3} {6}
chunk    {5} polyfills.bundle.js, polyfills.bundle.map (polyfills) 418 kB {9} [initial]
chunk    {6} main.bundle.js, main.bundle.map (main) 143 kB {8} [initial]
chunk    {7} styles.bundle.js, styles.bundle.map (styles) 412 kB {9} [initial]
chunk    {8} vendor.bundle.js, vendor.bundle.map (vendor) 4.72 MB [initial]
chunk    {9} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry]
webpack: bundle is now VALID.

First run is with a single line change, the others are without any changes at all. With https://github.com/AngularClass/angular2-webpack-starter the time goes to 1s (sometimes less), since it uses the DLLplugin (my guess as to the reason). Unfortunately we can't easily switch over because we are making heavy use of the cli's environments and testing setup, and it would be better to use the "official" setup.

Anyway, we might be sort of a special case since we are loading most of RxJS, ThreeJS, Openlayers, D3, crypto-js, lodash, turf and a bunch more.

hccampos avatar Feb 06 '17 07:02 hccampos

Hi, just wanted to say that I upgraded from beta 18 to 1.0.0 RC1, and the performance increase is spectacular, went from average rebuild of ~3-4 seconds to ~600ms-1000ms. I run "ng build --watch". Great job on getting this to an acceptable level.

I've got an Asus Zenbook 12gb ram, SSD.

guiomie avatar Mar 05 '17 23:03 guiomie

I would also be remiss without giving serious kudos to the team. I've been updating regularly over the last few months and the last few builds have shown a massive performance increase. Huge thanks all!

jmlivingston avatar Mar 06 '17 01:03 jmlivingston

Totally agree with John. Great work! Thanks.

On Mon, Mar 6, 2017 at 1:52 AM, John Livingston [email protected] wrote:

I would also be remiss without giving serious kudos to the team. I've been updating regularly over the last few months and the last few builds have shown a massive performance increase. Huge thanks all!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/1980#issuecomment-284283953, or mute the thread https://github.com/notifications/unsubscribe-auth/AV1APdJ3JPHglkLsZZmR-FkicvzyjGTGks5ri2bJgaJpZM4J07P9 .

-- Alban Xhaferllari PHP Developer User Team

albandaft avatar Mar 06 '17 09:03 albandaft

We aim to please 😄

filipesilva avatar Mar 06 '17 12:03 filipesilva

I'm seeing 40-60 second build times with rc4, thought this was normal...

hanvyj avatar Mar 24 '17 21:03 hanvyj

@hanvyj build or rebuild? Our build times are now at nearly two minutes. Rebuilds are at 3s for no changes up to 30s in some cases. Did some profiling and it is mostly the source maps which are insanely slow. Disable them and builds become way faster...while debugging becomes a nightmare. All in all, you are still quite lucky I think. If things get really bad, there is always the option of ejecting. We have been considering it for a while.

hccampos avatar Mar 24 '17 21:03 hccampos

Rebuild. The original build is a little longer. I've seen it as low as 46, but just then it was 88:

Imgur

I'll try enabling source maps only if I'm doing some serious debugging. Thanks.

There's probably some other optimizations I can do, I'll google around a bit.

hanvyj avatar Mar 24 '17 21:03 hanvyj

@hanvyj What's your command line look like?

clydin avatar Mar 24 '17 22:03 clydin

I run it with an NPM command that calls "ng serve --aot=true --proxy-config proxy.conf.json":

"startNoServer": "concurrently --kill-others \"ng serve --aot=true --proxy-config proxy.conf.json\"",

I played with a project that split the vendor bundle into a separate webpack script that didn't watch for changes. (it's rarely changed), I think it was all dealing with webpack without the CLI though. Is something like that possible with the CLI (it adds so much functionality and ease of use I'd take it over a faster build and setting up webpack myself!)

hanvyj avatar Mar 24 '17 22:03 hanvyj

That explains it. AoT is extremely slow, too slow to be used while developing.

hccampos avatar Mar 24 '17 22:03 hccampos

Ah, so I should turn it off when developing. I guess I'd have to be careful to not cause any changes that would break an AoT production build. Gets it down to 36 seconds build time, 5 second rebuild time - which is great!

I guess I'll have to be careful not to do anything that could break AoT though (interestingly, turning it off highlighted a few errors, a service not marked as @Injectable(), no idea how that worked with AoT on!).

Seems my method of creating Modal dialogs is completely broken, but there's a guide here I'll give a good read: https://angular.io/docs/ts/latest/cookbook/aot-compiler.html#!#jit-dev-aot-prod

hanvyj avatar Mar 24 '17 22:03 hanvyj

I have hello world project created with ng new HelloWorld

then I run ng build. Takes 62 seconds.

Then I change a line in hello world I run ng build, and it takes 62 seconds again. Is this normal? Is this how you develop?

cyberprodigy avatar Apr 23 '17 12:04 cyberprodigy

@cyberprodigy please open a separate issue including the information from the template so that we can fully assist you. Please also be sure that you are using the latest version (1.0.0 at this time). Thank you.

clydin avatar Apr 23 '17 12:04 clydin