angular/modules/benchmarks
Joey Perrott 9a27c5befb build: rename defaults2.bzl to defaults.bzl (#63384)
Use defaults.bzl for the common macros

PR Close #63384
2025-08-25 15:45:46 -07:00
..
src build: rename defaults2.bzl to defaults.bzl (#63384) 2025-08-25 15:45:46 -07:00
benchmark_test.bzl build: move from using WORKSPACE to MODULE.bazel (#63249) 2025-08-20 08:27:00 +00:00
BUILD.bazel build: rename defaults2.bzl to defaults.bzl (#63384) 2025-08-25 15:45:46 -07:00
e2e_test.bzl build: move from using WORKSPACE to MODULE.bazel (#63249) 2025-08-20 08:27:00 +00:00
README.md build: use pnpm as the package manager instead of yarn (#62924) 2025-07-31 22:06:27 +00:00
tsconfig-build.json build: rework benchmarks and examples in modules/ to new optimization rule (#61566) 2025-05-29 14:39:11 -04:00
tsconfig-e2e.json build: migrate modules to use @rules_browsers protractor rules (#62342) 2025-06-27 22:27:08 +00:00
tsconfig.json test: use zone from npm instead of the locally built package for modules testing (#61947) 2025-06-06 15:20:11 -07:00

How to run the benchmarks locally

Run in the browser

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

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

Run e2e tests

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

# Run all e2e tests:
pnpm 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:

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