angular-cn/packages/compiler-cli/ngcc/src
JoostK fd44d84a33 perf(ngcc): reduce maximum worker count (#38840)
Recent optimizations to ngcc have significantly reduced the total time
it takes to process `node_modules`, to such extend that sharding across
multiple processes has become less effective. Previously, running
ngcc asynchronously would allow for up to 8 workers to be allocated,
however these workers have to repeat work that could otherwise be shared.
Because ngcc is now able to reuse more shared computations, the overhead
of multiple workers is increased and therefore becomes less effective.
As an additional benefit, having fewer workers requires less memory and
less startup time.

To give an idea, using the following test setup:

```bash
npx @angular/cli new perf-test
cd perf-test
yarn ng add @angular/material
./node_modules/.bin/ngcc --properties es2015 module main \
  --first-only --create-ivy-entry-points
```

We observe the following figures on CI:

|                   | 10.1.1    | PR #38840 |
| ----------------- | --------- | --------- |
| Sync              | 85s       | 25s       |
| Async (8 workers) | 22s       | 16s       |
| Async (4 workers) | -         | 11s       |

In addition to changing the default number of workers, ngcc will now
use the environment variable `NGCC_MAX_WORKERS` that may be configured
to either reduce or increase the number of workers.

PR Close #38840
2020-09-15 11:23:09 -07:00
..
analysis refactor(compiler-cli): introduce the TemplateTypeChecker abstraction (#38105) 2020-07-29 10:31:20 -07:00
dependencies refactor(ngcc): move `logging` code into `ngtsc` (#37114) 2020-06-22 13:38:47 -07:00
entry_point_finder fix(compiler-cli): ensure file_system handles mixed Windows drives (#37959) 2020-07-13 12:05:21 -07:00
execution perf(ngcc): introduce cache for sharing data across entry-points (#38840) 2020-09-15 11:23:04 -07:00
host fix(ngcc): use aliased exported types correctly (#38666) 2020-09-08 11:41:21 -07:00
locking fix(ngcc): ensure lockfile is removed when analyzeFn fails (#37739) 2020-06-29 10:29:11 -07:00
migrations build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
packages perf(ngcc): introduce cache for sharing data across entry-points (#38840) 2020-09-15 11:23:04 -07:00
rendering fix(compiler-cli): ensure file_system handles mixed Windows drives (#37959) 2020-07-13 12:05:21 -07:00
writing fix(compiler-cli): ensure file_system handles mixed Windows drives (#37959) 2020-07-13 12:05:21 -07:00
command_line_options.ts refactor(ngcc): update yargs and typings for yargs (#38470) 2020-08-17 15:30:33 -07:00
constants.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
main.ts perf(ngcc): reduce maximum worker count (#38840) 2020-09-15 11:23:09 -07:00
ngcc_options.ts perf(ngcc): reduce maximum worker count (#38840) 2020-09-15 11:23:09 -07:00
path_mappings.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
utils.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00