Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
refactor(perf): canonicalize wt-perf prune-fixture layering + completion config (#3548)
Maximilian Roos166e1190ba55
diff --git a/benches/CLAUDE.md b/benches/CLAUDE.mdindex 5e4cc2dd4..7538c77ce 100644--- a/benches/CLAUDE.md+++ b/benches/CLAUDE.md@@ -32,6 +32,32 @@ cargo bench --bench picker_preview # all variantscargo bench --bench picker_preview warm # warm only```+## Fixtures and Benches++**Bench groups are named for what they measure; fixtures for the repo shape they+build.** The two never match by convention because the relationship is+many-to-one — one fixture feeds several bench groups that measure different+things (`RepoConfig::typical` alone backs five). Don't read a bench group and its+fixture as duplicates of each other: `full` is a benchmark, `mixed` is the repo+it runs on.++| Fixture (generator) | `wt-perf setup` handle | Bench group(s) |+|---|---|---|+| `RepoConfig::typical(N)` | `typical-N` | `skeleton`, `worktree_scaling` (list.rs); `first_output` (time_to_first_output.rs); `picker_preview`; `remove_e2e` |+| `RepoConfig::branches(N, M)` | `branches-N[-M]` | `completion_switch` (completion.rs) |+| `RepoConfig::many_divergent_branches()` | `divergent` | `divergent_branches` (list.rs) |+| `create_mixed_repo(W, B)` | `mixed-W-B` | `full` (list.rs) |+| `create_prune_repo_at(M, U)` | `prune-M-U` | `prune_e2e` (prune.rs) |+| `ensure_prune_real_repo(M, U)` | `prune-real[-M-U]` | `prune_real_repo` (prune.rs) |+| rust-lang/rust clone (`clone_rust_repo`) | — | `real_repo`, `real_repo_many_branches` (list.rs) |+| `lean_worktrees` (local to alias.rs) | — | `dispatch` (alias.rs) |+| `RepoConfig::picker_test()` | `picker-test` | — (interactive picker debugging only) |++Renaming a bench group is not free: `.github/scripts/criterion-to-jsonl.py`+keys each time-series row by the criterion output path (`<group>/<id>`), and the+daily `benchmarks` workflow appends those to a gist. A rename orphans that+series.+## Rust Repo CachingReal repo benchmarks clone rust-lang/rust on first run (~2-5 minutes). The clone is cached in `target/wt-perf/bench-repos/` and reused. Corrupted caches are auto-recovered.diff --git a/benches/completion.rs b/benches/completion.rsindex 6c9437b72..f10660c1e 100644--- a/benches/completion.rs+++ b/benches/completion.rs@@ -23,15 +23,7 @@ fn bench_completion_switch(c: &mut Criterion) {// Without worktrees: all branches are candidatesgroup.bench_function("branches_only", |b| {- let config = RepoConfig {- commits_on_main: 1,- files: 1,- branches: 50,- commits_per_branch: 0,- worktrees: 0,- worktree_commits_ahead: 0,- worktree_uncommitted_files: 0,- };+ let config = RepoConfig::branches(50, 0);let temp = create_repo(&config);let repo = temp.path().join("repo");b.iter(|| run_completion(binary, &repo, &["wt", "switch", ""]));@@ -40,13 +32,8 @@ fn bench_completion_switch(c: &mut Criterion) {// With worktrees: filters out branches that already have worktreesgroup.bench_function("with_worktrees", |b| {let config = RepoConfig {- commits_on_main: 1,- files: 1,- branches: 50,- commits_per_branch: 0,worktrees: 10,- worktree_commits_ahead: 0,- worktree_uncommitted_files: 0,+ ..RepoConfig::branches(50, 0)};let temp = create_repo(&config);let repo = temp.path().join("repo");diff --git a/tests/helpers/wt-perf/src/lib.rs b/tests/helpers/wt-perf/src/lib.rsindex 60d874826..3bc2a4408 100644--- a/tests/helpers/wt-perf/src/lib.rs+++ b/tests/helpers/wt-perf/src/lib.rs@@ -1119,8 +1119,7 @@ pub fn create_prune_repo_at(merged: usize, unmerged: usize, base_path: &Path) {worktree_uncommitted_files: 0,};create_repo_at(&config, base_path);- add_diverged_backdrop(base_path, unmerged, unmerged);- add_squash_merged(base_path, merged, 0);+ add_prune_populations(base_path, merged, unmerged);// The squash commits advanced main past the fake remote ref written by// `create_repo_at`; refresh so origin/main tracks the final tip.setup_fake_remote(base_path);@@ -1209,6 +1208,20 @@ pub fn add_squash_merged(repo_path: &Path, count: usize, round: usize) {}}+/// Add the two populations that turn a repo into a `wt step prune` workload:+/// `unmerged` two-sided-diverged worktrees and branches (`add_diverged_backdrop`+/// — the backdrop prune scans every run but never removes) and `merged`+/// squash-merged candidate pairs (`add_squash_merged` — what prune removes).+///+/// The base repo is the only thing the synthetic ([`create_prune_repo_at`]) and+/// rust-scale (`create_prune_real_repo_at`) prune fixtures differ in; both layer+/// these identical populations on top, so keeping the layering in one place+/// stops the two fixtures from drifting.+fn add_prune_populations(base_path: &Path, merged: usize, unmerged: usize) {+ add_diverged_backdrop(base_path, unmerged, unmerged);+ add_squash_merged(base_path, merged, 0);+}+/// Default populations for the rust-scale prune fixture (`prune-real`):/// 12 squash-merged candidates of each kind + 24 unmerged worktrees and/// branches → 36 linked worktrees, and a live prune that removes 24@@ -1236,8 +1249,7 @@ pub const PRUNE_REAL_UNMERGED: usize = 24;/// `target/wt-perf/bench-repos` and repairs consumed candidates on later runs.fn create_prune_real_repo_at(merged: usize, unmerged: usize, base_path: &Path) {clone_rust_repo_at(base_path);- add_diverged_backdrop(base_path, unmerged, unmerged);- add_squash_merged(base_path, merged, 0);+ add_prune_populations(base_path, merged, unmerged);}/// How a cached prune fixture compares to its expected populations.