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

+1 Rebuilds are extremely slow for me on OSX 10.11.6

stellasoft-george avatar Sep 07 '16 09:09 stellasoft-george

+1 also quite slow on linux x64 after I moved my assets from the app folder to the appropriate assets folder, it now optimizes the assets folder every time I make a change to any of the code which seems to be the reason for the added delay.

RicardoVaranda avatar Sep 08 '16 21:09 RicardoVaranda

@TheLarkInn can you weigh in? It seems related with CopyWebpackPlugin.

filipesilva avatar Sep 16 '16 03:09 filipesilva

I also have a very slow "chunk assert optimization" step (~8s all the time even for small changes in one file). looking at https://github.com/webpack/webpack/issues/539#issuecomment-111275792 it seems it could be due to the source-map configuration chosen.

ghost avatar Sep 28 '16 10:09 ghost

Would DLL loading for vendor items help here? They must be 90% of bundle size

intellix avatar Sep 28 '16 12:09 intellix

+1 build/rebuilds extremely slow, as well as the update/recompiling in the browser. as well as ng test

dasAnderl avatar Oct 05 '16 10:10 dasAnderl

+1, new to angular2. I really like how it was easy to get started, sadly, keeping going is much harder. Every time I modify a file and save, it takes more than 10 seconds before I can reload the browser and see my update. For web development, I can't do this. Maybe I'll switch to Angular2 JS.

Here is what I see in my shell on ubuntu:

webpack: bundle is now VALID.
webpack: bundle is now INVALID.
1337ms building modules                                                       
19ms sealing
1ms optimizing 
0ms basic module optimization 
468ms module optimization
3ms advanced module optimization 
56ms basic chunk optimization       
0ms chunk optimization 
0ms advanced chunk optimization 
51ms module and chunk tree optimization
900ms module reviving
8ms module order optimization 
11ms module id optimization
9ms chunk reviving 
2ms chunk order optimization 
44ms chunk id optimization
212ms hashing
1ms module assets processing 
0ms chunk assets processing 
11ms additional chunk assets processing
0ms recording 
1ms additional asset processing 
0ms chunk asset optimization 
1618ms asset optimization
1ms emitting 
Hash: 8e4aceb7595d757b77f1
Version: webpack 2.1.0-beta.22
Time: 12081ms
           Asset     Size  Chunks       Chunk Names
  main.bundle.js  4.04 MB    0, 2       main
styles.bundle.js  10.2 kB    1, 2       styles
       inline.js  5.53 kB       2       inline
        main.map  4.31 MB    0, 2       main
      styles.map    14 kB    1, 2       styles
      inline.map  5.59 kB       2       inline
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks       Chunk Names
    index.html  3.69 kB       0  

guiomie avatar Oct 06 '16 04:10 guiomie

Same issue here.

thorsten avatar Oct 06 '16 11:10 thorsten

https://github.com/angular/angular-cli/pull/2570 moved away from CopyWebpackPlugin to a simpler glob copy. This should help with @RicardoVaranda's issue.

filipesilva avatar Oct 09 '16 21:10 filipesilva

@asadsahi with beta.17 I registered a 6633ms second rebuild time, is this in line with your experience?

webpack: bundle is now INVALID.
406ms building modules
15ms sealing
1ms optimizing
1ms basic module optimization
133ms module optimization
58ms advanced module optimization
49ms basic chunk optimization
1ms chunk optimization
0ms advanced chunk optimization
36ms module and chunk tree optimization
167ms module reviving
4ms module order optimization
9ms module id optimization
6ms chunk reviving
2ms chunk order optimization
39ms chunk id optimization
58ms hashing
4ms module assets processing
78ms chunk assets processing
5ms additional chunk assets processing
1ms recording
1ms additional asset processing
1992ms chunk asset optimization
532ms asset optimization
53ms emitting
Hash: ee2a562c10e2a5133f8d
Version: webpack 2.1.0-beta.25
Time: 6633ms
                                 Asset     Size  Chunks             Chunk Names
                      styles.bundle.js   173 kB    7, 9             styles
  25a32416abee198dd821b0b17a198a8f.eot  76.5 kB
  1dc35d25e61d819a9c357074014867ab.ttf   153 kB
 c8ddf1e5e5bf3682bc7bebf30f394148.woff  90.4 kB
e6cf7c6ec7c2d6f670ae9d762604cb0b.woff2  71.9 kB
                            0.chunk.js    36 kB    0, 9
                            1.chunk.js  16.9 kB    1, 9
                            2.chunk.js  21.8 kB    2, 9
                            3.chunk.js  9.87 kB    3, 9
                            4.chunk.js  14.5 kB    4, 9
                            5.chunk.js  11.9 kB    5, 9
                        main.bundle.js  4.42 MB    6, 9  [emitted]  main
  d7c639084f684d66a1bc66855d193ed8.svg   392 kB
                     scripts.bundle.js   466 kB    8, 9             scripts
                             inline.js  5.53 kB       9             inline
                                 0.map  30.7 kB    0, 9
                                 1.map    15 kB    1, 9
                                 2.map  18.8 kB    2, 9
                                 3.map  7.45 kB    3, 9
                                 4.map  13.3 kB    4, 9
                                 5.map  9.82 kB    5, 9
                            styles.map   236 kB    7, 9             styles
                           scripts.map   576 kB    8, 9             scripts
                            inline.map  5.59 kB       9             inline
                              main.map  4.66 MB    6, 9  [emitted]  main
Child html-webpack-plugin for "index.html":
         Asset    Size  Chunks       Chunk Names
    index.html  3.8 kB       0
webpack: bundle is now VALID.

filipesilva avatar Oct 09 '16 22:10 filipesilva

@filipesilva I also noticed rebuilds are about two times faster when I upgraded from beta.16 to beta.17; with average of 4 seconds.

I'm still new to webpack world, so I don't yet really understand how things work internally, but after a quick search I found https://github.com/TypeStrong/ts-loader/issues/78. Is this what's slowing down CLI's build process? I used custom gulp build process few months ago and had average 250ms rebuild times, so even 3-6 seconds with CLI is quite a setback ;(

Also, bit off topic, is it possible to isolate app code from vendor code in dev builds? Would that speed things up?

sasxa avatar Oct 10 '16 13:10 sasxa

250ms would be like a dream!

@filipesilva if I add all the ms in your run extract, we get: 3651ms total. There is still a 3 seconds missing right?

When I run ng-serve, change some code, save my file, the change from "webpack: bundle is now VALID" to "webpack: bundle is now INVALID", takes a few second. Could this be optimized also?

guiomie avatar Oct 10 '16 16:10 guiomie

@sasxa we don't use ts-loader, but I skimmed the issue and didn't find anything we could apply to the CLI.

@guiomie I am not too sure of how the numbers add up. All of that is handed over to webpack.

I also asked @TheLarkInn and there seem to be some incoming Webpack 2 optimizations that would help with speed.

filipesilva avatar Oct 10 '16 17:10 filipesilva

@filipesilva yes I can confirm that rebuilds are somewhere taking same amount of time and I also suspect its somewhere in webpack because I am having similar rebuild times in another non-cli based project based on webpack 2.

@sasxa webpack dll is for the purpose of separating vendor from application files for speeding up rebuilds.

asadsahi avatar Oct 10 '16 18:10 asadsahi

I see the similar issue and "ng serve" on any small sccs change reports these optimizations steps. It is very very slow. See the output:

webpack: bundle is now VALID.
webpack: bundle is now INVALID.
536ms building modules
6ms sealing
0ms optimizing
1ms basic module optimization
126ms module optimization
1ms advanced module optimization
25ms basic chunk optimization
0ms chunk optimization
0ms advanced chunk optimization
13ms module and chunk tree optimization
79ms module reviving
2ms module order optimization
5ms module id optimization
4ms chunk reviving
1ms chunk order optimization
16ms chunk id optimization
47ms hashing
1ms module assets processing
1ms chunk assets processing
4ms additional chunk assets processing
0ms recording
0ms additional asset processing
0ms chunk asset optimization
825ms asset optimization
5ms emitting

ng version:

angular-cli: 1.0.0-beta.16
node: 4.5.0
os: darwin x64

ipassynk avatar Oct 10 '16 22:10 ipassynk

same here , it's too slow!

angular-cli: 1.0.0-beta.17
node: 6.6.0
os: darwin x64

Version: webpack 2.1.0-beta.25
Time: 8100ms
            Asset       Size  Chunks             Chunk Names
   main.bundle.js    3.12 MB    0, 2  [emitted]  main
 styles.bundle.js    10.2 kB    1, 2  [emitted]  styles
        inline.js    5.53 kB       2  [emitted]  inline
         main.map    3.19 MB    0, 2  [emitted]  main
       styles.map    14.2 kB    1, 2  [emitted]  styles
       inline.map    5.59 kB       2  [emitted]  inline
       index.html  480 bytes          [emitted]  
assets/.npmignore    0 bytes          [emitted]  
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks       Chunk Names
    index.html  2.81 kB       0       
webpack: bundle is now VALID.

mhadaily avatar Oct 12 '16 15:10 mhadaily

See #2651

JanStureNielsen avatar Oct 12 '16 16:10 JanStureNielsen

@JanStureNielsen, that's not related to rebuild times but instead to initial npm installs.

I'm also experiencing the invalidation delay that @guiomie reported. As well as files not being marked as changed. @TheLarkInn, is there a plan to integrate watchman within webpack? It is highly effective at what it does.

clydin avatar Oct 12 '16 19:10 clydin

Should this be bumped as critical? It seems to impede peoples productivity and maybe scare new comers to angular-cli.

guiomie avatar Oct 14 '16 23:10 guiomie

to chime in here with some data of a fairly small angular2 project using scss:

angular-cli: 1.0.0-beta.17
node: 6.3.0
os: darwin x64

webpack: bundle is now VALID.
webpack: bundle is now INVALID.
526ms building modules                                                             
5ms sealing 
0ms optimizing 
0ms basic module optimization 
155ms module optimization
1ms advanced module optimization 
6ms basic chunk optimization        
0ms chunk optimization 
0ms advanced chunk optimization 
10ms module and chunk tree optimization
77ms module reviving
1ms module order optimization 
3ms module id optimization 
2ms chunk reviving 
0ms chunk order optimization 
11ms chunk id optimization
81ms hashing
1ms module assets processing 
106ms chunk assets processing
4ms additional chunk assets processing 
0ms recording 
0ms additional asset processing 
3427ms chunk asset optimization
596ms asset optimization
51ms emitting
Hash: 20f361734232b0bd829f
Version: webpack 2.1.0-beta.25
Time: 6997ms
           Asset     Size  Chunks             Chunk Names
  main.bundle.js  3.32 MB    0, 2  [emitted]  main
styles.bundle.js   138 kB    1, 2             styles
       inline.js  5.53 kB       2             inline
      styles.map   182 kB    1, 2             styles
      inline.map  5.59 kB       2             inline
        main.map  3.39 MB    0, 2  [emitted]  main
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks       Chunk Names
    index.html  2.81 kB       0       

The most time is spent on chunk asset optimization, so that looks like a worthwhile target.

JohannesRudolph avatar Oct 19 '16 10:10 JohannesRudolph