2016-08-26 19:27:24 +00:00
# How to run the benchmarks locally
## Run in the browser
2019-01-05 21:15:06 +00:00
```bash
2025-07-31 15:17:27 +00:00
pnpm bazel run modules/benchmarks/src/tree/{name}:devserver
2019-01-05 21:15:06 +00:00
2019-02-12 18:23:53 +00:00
# e.g. "ng2" tree benchmark:
2025-07-31 15:17:27 +00:00
pnpm bazel run modules/benchmarks/src/tree/ng2:devserver
2019-01-05 21:15:06 +00:00
```
2016-08-26 19:27:24 +00:00
## Run e2e tests
2016-08-30 16:29:39 +00:00
2019-02-12 18:23:53 +00:00
```
# Run e2e tests of individual applications:
2025-07-31 15:17:27 +00:00
pnpm bazel test modules/benchmarks/src/tree/ng2/...
2016-08-30 16:29:39 +00:00
2019-02-12 18:23:53 +00:00
# Run all e2e tests:
2025-07-31 15:17:27 +00:00
pnpm bazel test modules/benchmarks/...
2019-02-12 18:23:53 +00:00
```
2016-10-06 15:37:37 +00:00
2025-11-06 18:03:05 +00:00
## Use of \*\_aot.ts files
2016-10-06 15:37:37 +00:00
2019-02-12 18:23:53 +00:00
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.
2020-01-16 13:34:03 +00:00
## 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 ](https://docs.bazel.build/versions/master/command-line-reference.html#flag--test_env ):
2025-11-06 18:03:05 +00:00
- `PERF_SAMPLE_SIZE` : Benchpress performs measurements until `scriptTime` predictively no longer
2020-01-16 13:34:03 +00:00
decreases. It does this by using a simple linear regression with the amount of samples specified.
Defaults to `20` samples.
2025-11-06 18:03:05 +00:00
- `PERF_FORCE_GC` : If set to `true` , `@angular/benchpress` will run run the garbage collector
2020-01-16 13:34:03 +00:00
before and after performing measurements. Benchpress will measure and report the garbage
collection time.
2025-11-06 18:03:05 +00:00
- `PERF_DRYRUN` : If set to `true` , no results are printed and stored in a `json` file. Also
2020-01-16 13:34:03 +00:00
benchpress only performs a single measurement (unlike with the simple linear regression).
2025-11-06 18:03:05 +00:00
2020-01-16 13:34:03 +00:00
Here is an example command that sets the `PERF_DRYRUN` option:
```bash
2025-07-31 15:17:27 +00:00
pnpm bazel test modules/benchmarks/src/tree/baseline:perf --test_env=PERF_DRYRUN=true
2025-11-06 18:03:05 +00:00
```