Files
Jason Jean 7439d58b22 chore(repo): add CLI performance benchmarks (#35078)
## Current Behavior

No standardized way to measure Nx CLI performance or detect regressions.

## Expected Behavior

A `benchmarks/` workspace provides reproducible CLI performance
benchmarks using [hyperfine](https://github.com/sharkdp/hyperfine).

### Project Structure

1110 dummy projects in a 3-level fan-out (10 groups → 10 subs → 10
leaves) with implicit dependencies.

### Benchmarks

| Benchmark | Command | Outputs | Dependencies | What it measures |
| --------------- | --------------------- | ------- | ------------ |
----------------------------------------- |
| `version` | `nx --version` | — | — | CLI startup / module loading |
| `show-projects` | `nx show projects` | — | — | Project graph query via
daemon |
| `cat-warm` | `cat lorem.md` × 1110 | No | Flat | Task scheduling +
hashing (no output I/O) |
| `lint-warm` | `cp lorem.md` × 1110 | Yes | Flat | Cached tasks with
output tracking |
| `build-warm` | `cp lorem.md` × 1110 | Yes | Topological | Cached tasks
with deps (disabled) |

### Usage

```bash
# Run all benchmarks
pnpm bench

# Run a single benchmark
pnpm nx bench:cat-warm benchmarks

# Set local baseline for comparison
pnpm bench -- --set-baseline
```

### How it works

- Each `bench:*` target runs hyperfine with `--setup 'nx reset'` (clean
daemon) and `--warmup 1` (warm daemon for measurements)
- `goals.json` (committed) defines target times the team agrees on
- `baseline.json` (gitignored) captures local per-machine numbers for
personal comparison
- First run auto-saves a baseline; subsequent runs compare against it
- The report shows colored deltas against both goals and baseline
- Benchmarks run in CI via `nx affected --targets=bench` on
`linux-large` agents

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: FrozenPandaz <FrozenPandaz@users.noreply.github.com>
2026-04-03 13:40:06 -04:00

7 lines
97 B
Plaintext

benchmarks/packages
nx-dev/**/jest.config.js
.next
_files
_solution
nx-dev/tutorial/**/templates