Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow watch mode #1580

Closed
rmannibucau opened this issue Mar 19, 2020 · 2 comments · Fixed by #1704
Closed

Slow watch mode #1580

rmannibucau opened this issue Mar 19, 2020 · 2 comments · Fixed by #1704

Comments

@rmannibucau
Copy link

Type of Issue

[ ] Bug Report
[X] Feature Request

Description

Using watch mode should enable to have fast update roud trip, however ngc phase stays slow whereas other phases are acceptable.

How To Reproduce

Build a project with some dependencies and angular 9.0.x.

Expected Behaviour

A simple update (even just forcing a file save) should refresh the umd files in really max around 1s, today it is ~4-5s on my computer.

Version Information

$ node_modules/.bin/ng-packagr --version
ng-packagr: 9.0.3
@angular/*: 9.0.7
typescript: 3.7.5
rxjs: 6.5.4
node: v12.14.1
npm: 6.13.4
// lib
@ngx-formly/material": "^5.5.13

If it helps: main slowness points are (from compile-source-files):

  1. ngProgram.loadNgStructureAsync
  2. ngProgram.getNgSemanticDiagnostics (and a few other get...Diagnostics): here program.getSourceFiles() is iterated and tests with a regex (without ivy) the files. By it self it is fast by since the number of file is often ~720 (even for small projects, it comes from deps), then the regex test and extraction become way slower than a plain endsWith/subtring impl (see Make compiler-cli use less regexes for performances angular/angular#36148 (comment) for details). Guess some optimization is doable on ng-packgr side.
  3. compile-ngc.transform does 2 compilations calling 2 which the "same" cost i spaid twice.

Side note: the rest of the compilation round trip is acceptable, it is really the ngc phase which is slow.

@alan-agius4
Copy link
Member

Thanks @rmannibucau, thanks for this issue and the superb investigation 👍.

alan-agius4 added a commit that referenced this issue Jul 22, 2020
With this change we cache rollup AST and plugin cache between incremental runs

Closes #1580
@github-actions
Copy link

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

This action has been performed automatically by a bot.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging a pull request may close this issue.

2 participants