Rebuild extremely slow
-
OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Windows 10
-
Versions. Please run
ng --version. If there's nothing outputted, please run in a Terminal:node --versionand paste the result here: angular-cli: 1.0.0-beta.11-webpack.8 node: 6.3.0 os: win32 x64 -
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.
-
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
-
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.
Worth noting that --hmr is not a mainstream case though. Many people won't use it or won't be able to use it in their apps.
Not to mention people not using serve at all. At my current customer we are using build --watch because we are required to be as close as possible to our production which runs IIS, so we use this in local dev (and have some IIS modules running as well, etc).
Great, now using beta 22 with ng serve --no-sourcemap --hmr -e=dev-hmr with hmr config following https://github.com/jschwarty/angularcli-hmr-example/
Gives me acceptable timings, around 5 seconds from save to browser ready.
Guys, Having stats of roughly 2-3 seconds as rebuild time with angular-cli@beta22 on a beefy machine using ng serve --no-sourcemap --hmr -e=dev-hmr. Without sourcemaps? Really?
My personal opinion is that it is still not the ideal time we should be looking for. DLL is the only way out of having rebuild less than ~0.5 seconds to improve developer productivity. As I mentioned in few of my earlier comments that I have ~300-400ms as rebuild time in a non-cli project using(webpack2@beta27 with DLL). And this is with cheap-module-source-map enabled.
HMR drastically improves the time for the developer. 5 seconds means delay between hitting ctrl+s and page is ready in browser (including template compilation in the browser). Used to be more than 15 before beta 22.
Indeed, huge difference between beta 21 and beta 22. But Is that Ideal?
The point I am trying to make is that developer still waiting mostly for the 3rd party libraries. If a component.ts or component.html file is changed, recompilation should be quick. And DLL is the way to achive that.
I'd like to try the improvements in beta.22, but is it just me or is beta.22 not on npm yet? Are there any plans for pushing it there?
@JohannesRudolph It's on npm, just not marked as latest yet. You can check the current setup from terminal:
$ npm dist-tag ls angular-cli
experimental: 1.0.0-beta.22
latest: 1.0.0-beta.21
To test beta 22 right now, you have to follow https://github.com/angular/angular-cli#updating-angular-cli but change latest to experimental in the provided commands.
beta 22 is much better but still way too slow for my company to be able to consider uaing angular-cli yet.
Experiment: I made RAM disk and copy my project to it. Build time is very small. For angular-cli beta 22 new project builds on 3-4 seconds and rebuilds when changed on 0.5-1.2 seconds. It is pretty cool.
@khodeN of course ram disk makes the building way more faster. You can put the whole OS into a 1TB ram disk ,then you can fly! :)
Alright , I am just kidding . So your exp probably proved that this is mostly an IO issue.
With both beta21 and beta22, I have a 50sec build time with ng serve from the empty project. Also running ng -v takes 14sec.
Running on win10, both as normal user and as admin
If you would update to the latest one you'd see a massive improvement, I also had problems back in September with this but with the latest version I have +/- 2 secs compilation:
Time: 2394ms
chunk {0} main.bundle.js, main.bundle.map (main) 137 kB {3} [initial]
chunk {1} styles.bundle.js, styles.bundle.map (styles) 29 kB {4} [initial]
chunk {2} scripts.bundle.js, scripts.bundle.map (scripts) 227 kB {4} [initial]
chunk {3} vendor.bundle.js, vendor.bundle.map (vendor) 3.27 MB [initial]
chunk {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry]
webpack: bundle is now VALID.
I'm on latest already... beta.22
@hansl the metric I'll use is similar performance to a webpack2 project that is only using @ngtools/webpack plus the simplest possible optimizations (like vendor chunk or DLL). I'll get the baseline numbers and share them here, then aim at figuring out how our CLI setup affects them.
@simonech that's very odd, I've never seen that much delay. To be absolutely sure, can you try this please?
npm uninstall angular-cli -g
npm cache clean
npm install angular-cli -g
ng new test-proj
cd test-proj
ng build # check build time here
ng serve # check serve time here
Can you also tell me your system specs, and anything else you think is relevant about your system?
Hey all, I've been doing some more benchmarks to figure out if we have some gross inefficiencies in our webpack config.
To test that, I setup a very simple webpack app with lazy loading that uses @ngtools/webpack as the Typescript plugin. You can find it https://github.com/filipesilva/angular-cli-benchmark-app.
webpack-runner.js is a script that'll modify the webpack config to have similar defaults as ng build/serve and to let you change it easily.
These are the benchmarks I got with that repo: https://gist.github.com/filipesilva/427b0369ccfc7d4d60b77aea90b71141#file-webpack-config-txt
The most significant one is the rebuild time:
Base command: npm start -- --serve
Comment: third rebuild time
Full command: npm start -- --serve
Average time: 2935.8
Results: 2787,3068,2706,3194,2924
I also rank the same app through a similar benchmark using the ng build/serve commands: https://gist.github.com/filipesilva/427b0369ccfc7d4d60b77aea90b71141#file-ng-txt
Base command: ng serve --no-progress
Comment: third rebuild time
Full command: ng serve --no-progress
Average time: 1693.4
Results: 1705,1672,1772,1718,1600
As far as my benchmarks show, there is no significant performance loss using ng build/serve versus using a plain webpack config. On the contrary even: rebuilds with the CLI take half the time.
To be honest this result surprised me as I expected most of our custom plugins and logic to take a toll on the build time.
So for me this validates the current config generation as performant as a simple webpack config, meaning there shouldn't be any gross inefficiencies.
The next step is to try and integrate something like DLL Plugin, which should speed rebuilds up.
I had a go at it today, and you can even try it on https://github.com/filipesilva/angular-cli-benchmark-app with npm start -- --dll but am running into some problems with the lazy loaded chunks.
I also need to find a way to dynamically create the list of modules that will be included in the DLL bundle since users shouldn't have to list them manually.
I'll keep you posted on the progress, and if you have suggestions or optimisations I'd love to hear it.
Nice work @filipesilva . I am really counting on DLL implementation, I believe many of us will be amazed how quick rebuild can be with dll. I have seen 200-300ms rebuilds in a medium sized project. (Obviously depends upon the hardware app runs).
Also, Thumbs up for dynamically creating list of dll bundle.
@filipesilva Did some tests, and I realized I was on power saving mode. But still with high performance settings build takes 23sec and serve takes 30sec. Feels too much anyway
Systems specs: Microsoft Surface Pro Intel Core i5-3317U @ 1.70 GHz RAM 4Gb SSD 128Gb Windows 10
Space available on the disk is not much, just a few Gb
Install went fine, only warning I got was
npm WARN optional Skipping failed optional dependency /angular-cli/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
ng new took 65sec till it said Installing packages for tooling via npm. and 6:30" for completing the npm install
ng build: 1:05"... 17" till the first message appeared, 49sec build time as reported in the output
ng serve: 1:12" with a stop watch: 17" secs till first message, 55sec as reported in the output
Also ng -v takes 13" sec
angular-cli: 1.0.0-beta.24
node: 6.9.1
os: win32 x64
@angular/common: 2.4.0
@angular/compiler: 2.4.0
@angular/core: 2.4.0
@angular/forms: 2.4.0
@angular/http: 2.4.0
@angular/platform-browser: 2.4.0
@angular/platform-browser-dynamic: 2.4.0
@angular/router: 3.4.0
@angular/compiler-cli: 2.4.0
Here how power settings affect the build time. Running as admin doesn't affect much
- Power saving:
ng build: 17 sec initial lag, 49sec build, 1:05 overallng serveng -v: 13sec
- Balanced:
ng build: 7sec initial lag, 18sec build time, 25sec overallng serve: 7sec initial lag, 18sec build time, 25sec overallng -v: 5 sec
- High perf:
ng build: 5sec initial lag, 17sec build time, 23sec overallng serve: 6sec initial lag, 22sec build time, 30sec overallng -v: 5 sec
@simonech It's definitely way too much time, especially for an empty project. I really cannot fathom how could do that. Perhaps an overly aggressive antivirus, or a dying SSD...
You know anyone else with a similar Surface Pro that could try? For a brand new project you should be seeing numbers similar to https://gist.github.com/filipesilva/427b0369ccfc7d4d60b77aea90b71141#file-ng-txt
Yeah, but the 5-6 sec for just ng -v should not be affected by av or disk, right? Will try from a beefier machine tomorrow and see. Thx
Sent from my iPad
On 21 Dec 2016, at 22:56, Filipe Silva [email protected] wrote:
@simonech It's definitely way too much time, especially for an empty project. I really cannot fathom how could do that. Perhaps an overly aggressive antivirus, or a dying SSD...
You know anyone else with a similar Surface Pro that could try? For a brand new project you should be seeing numbers similar to https://gist.github.com/filipesilva/427b0369ccfc7d4d60b77aea90b71141#file-ng-txt
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Part of the ember-cli addon discovery code does walk node deps to see if there are addons there, so disk speed would affect it. I'd never expect it to take more than 3 seconds on HDD evens though. It's something we want to remove though.