angular-docs-cn/modules/benchmarks
Paul Gschwendtner 1601ee6f6a refactor(dev-infra): ng_rollup_bundle rule should leverage `@bazel/rollup` (#37623)
Refactors the `ng_rollup_bundle` rule to a macro that relies on
the `@bazel/rollup` package. This means that the rule no longer
deals with custom ESM5 flavour output, but rather only builds
prodmode ES2015 output. This matches the common build output
in Angular projects, and optimizations done in CLI where
ES2015 is the default optimization input.

The motiviation for this change is:

* Not duplicating rollup Bazel rules. Instead leveraging the official
rollup rule.
* Not dealing with a third TS output flavor in Bazel.The ESM5 flavour has the
potential of slowing down local development (as it requires compilation replaying)
* Updating the rule to be aligned with current CLI optimizations.

This also _fixes_ a bug that surfaced in the old rollup bundle rule.
Code that is unused, is not removed properly. The new rule fixes this by
setting the `toplevel` flag. This instructs terser to remove unused
definitions at top-level. This matches the optimization applied in CLI
projects. Notably the CLI doesn't need this flag, as code is always
wrapped by Webpack. Hence, the unused code eliding runs by default.

PR Close #37623
2020-06-22 10:55:28 -07:00
..
src refactor(dev-infra): ng_rollup_bundle rule should leverage `@bazel/rollup` (#37623) 2020-06-22 10:55:28 -07:00
BUILD.bazel revert: "revert: "feat(dev-infra): exposed new rule 'component_benchmark' via dev_infra (#36434)" (#36798)" (#36800) 2020-06-03 13:12:30 -07:00
README.md test: ensure global options for benchmark tests can be set in bazel (#34753) 2020-01-29 09:22:27 -08:00
e2e_test.bzl revert: "revert: "feat(dev-infra): exposed new rule 'component_benchmark' via dev_infra (#36434)" (#36798)" (#36800) 2020-06-03 13:12:30 -07:00
tsconfig-build.json build: serve benchmark tree examples with bazel (#28568) 2019-02-08 13:37:36 -08:00
tsconfig-e2e.json refactor(benchpress): added tsconfig and fixed ts errors (#35127) 2020-02-04 10:41:06 -08:00
tsconfig.json refactor(dev-infra): small changes and fixes (#36800) 2020-06-03 13:12:30 -07:00

README.md

How to run the benchmarks locally

Run in the browser

yarn bazel run modules/benchmarks/src/tree/{name}:devserver

# e.g. "ng2" tree benchmark:
yarn bazel run modules/benchmarks/src/tree/ng2:devserver

Run e2e tests

# Run e2e tests of individual applications:
yarn bazel test modules/benchmarks/src/tree/ng2/...

# Run all e2e tests:
yarn bazel test modules/benchmarks/...

Use of *_aot.ts files

The *_aot.ts files are used as entry-points within Google to run the benchmark tests. These are still built as part of the corresponding ng_module rule.

Specifying benchmark options

There are options that can be specified in order to control how a given benchmark target runs. The following options can be set through test environment variables:

  • PERF_SAMPLE_SIZE: Benchpress performs measurements until scriptTime predictively no longer decreases. It does this by using a simple linear regression with the amount of samples specified. Defaults to 20 samples.
  • PERF_FORCE_GC: If set to true, @angular/benchpress will run run the garbage collector before and after performing measurements. Benchpress will measure and report the garbage collection time.
  • PERF_DRYRUN: If set to true, no results are printed and stored in a json file. Also benchpress only performs a single measurement (unlike with the simple linear regression).

Here is an example command that sets the PERF_DRYRUN option:

yarn bazel test modules/benchmarks/src/tree/baseline:perf --test_env=PERF_DRYRUN=true