angular-cli: Extremely slow ng serve performance [Source Map compiling]

Bug Report or Feature Request (mark with an x)

- [x ] bug report
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [x ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

npm: 5.6.0

Angular CLI: 7.0.6 Node: 8.9.4 OS: win32 x64 Angular: 7.0.4 … animations, common, compiler, core, forms, http … platform-browser, platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.10.6 @angular-devkit/build-angular 0.10.6 @angular-devkit/build-optimizer 0.10.6 @angular-devkit/build-webpack 0.10.6 @angular-devkit/core 7.0.6 @angular-devkit/schematics 7.0.6 @angular/cdk 7.1.0 @angular/cli 7.0.6 @angular/compiler-cli 7.1.0 @angular/flex-layout 7.0.0-beta.19 @angular/language-service 7.1.0 @ngtools/webpack 7.0.6 @schematics/angular 7.0.6 @schematics/update 0.10.6 rxjs 6.3.3 typescript 3.1.6 webpack 4.19.1

Repro steps

Needs LARGE project, NOT empty project with ng new …, run npm start make changes wait for 10 min

The log given by the failure

N/A

Desired functionality

We have big project, and we’ve faced problem with ng serve updating/recompiling during update. Now faster to re-run ng serve instead wait for rebuilding

Mention any other details that might be useful

we use simple ng serve without AOT or PROD flag

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 35 (2 by maintainers)

Most upvoted comments

@alan-agius4

@mselerin do you see the same perf regression when using @ngtools/webpack 7.0.6?

I’m using @ngtools/webpack 7.0.7 but @angular-devkit/build-angular 0.10.7.

@alan-agius4 will try asap, thank you

Hi,

Thanks for the info provided. If you don’t mind can you try a couple of things that will help is determine what’s the root cause.

  1. Can you check how are the build/rebuild times with sourceMap turned off?

  2. Can you confirm if you have vendorSourceMap enabled or disabled?

  3. Can you open node_modules/@ngtools/webpack/src/benchmark.js, Change const _benchmark = false to true and run ng serve --verbose --no-progress it should indicate which parts of the compilation is taking more time. (Would be great if you could post the timings here of an initial and incremental build, and the console timings). Or preferably you can profile the ng serve using NG_CLI_PROFILING enviorment variable. So something like NG_CLI_PROFILING=$HOME/build ng serve would record and generate a CPU profile that chrome can load and show you performance analysis and provide a link to it here.

  4. And out of curiosity can you also run npm ls webpack-sources? This should not return any version prior to 1.2.0.