Skip to content

docs(bench): replace --skip with positional FILTER - #2547

Merged
max-sixty merged 1 commit into
mainfrom
bench-skip-docs
May 3, 2026
Merged

max-sixty merged 1 commit into
mainfrom
bench-skip-docs

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Criterion 0.8 (the maintained criterion-rs fork — already the latest) has no --skip flag; only positional substring [FILTER] and --exact. Four invocations in benches/CLAUDE.md and the benches/alias.rs header comment used --skip, which fails with unexpected argument '--skip' found.

Rewritten to use positional filters with concrete worked examples, plus a short note that Criterion has no exclusion flag and that benchmark IDs follow <group>/<label>/<param>. For the alias bench, dispatch/warm and dispatch/cold replace the previous --skip cold / --skip with_vars examples.

Verified cargo bench --bench alias dispatch/warm -- --measurement-time 5 --sample-size 10 runs exactly the two stub-warm variants.

Criterion 0.8 (the maintained criterion-rs fork — already the latest)
has no `--skip` flag; only positional substring `[FILTER]` and
`--exact`. Four invocations across `benches/CLAUDE.md` and the
`benches/alias.rs` header comment used `--skip`, which fails with
"unexpected argument '--skip' found".

Rewritten to use positional filters with concrete worked examples,
plus a one-line note explaining there's no exclusion flag and that
benchmark IDs follow `<group>/<label>/<param>`.

Verified `cargo bench --bench alias dispatch/warm -- --measurement-time
5 --sample-size 10` runs exactly the two stub-warm variants.

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit 05514ef into main May 3, 2026
26 of 27 checks passed
@max-sixty
max-sixty deleted the bench-skip-docs branch May 3, 2026 05:51
max-sixty added a commit that referenced this pull request May 3, 2026
- `run_timeline`'s leading doc-comment still said `WORKTRUNK_TRACE=1`
  even though the body sets `RUST_LOG=debug`. Update it to match.
- `benches/list.rs` header still showed `cargo bench --bench list --
  --skip cold` / `--skip real` examples — the same syntax #2547
  removed from the docs. Replace with the positional-FILTER form so
  the bench file's examples agree with `benches/CLAUDE.md` and the
  root `CLAUDE.md` Benchmarks section.

Co-Authored-By: Claude <[email protected]>
max-sixty added a commit that referenced this pull request May 3, 2026
## Summary

Adds `wt-perf timeline` to standardize how we capture and read traces
for one-off `wt` invocations (alias dispatch, `wt list`, etc.). Replaces
the prior `RUST_LOG=debug wt … 2>&1 | wt-perf trace > trace.json` dance
with a single command that runs `wt`, captures stderr, parses
`[wt-trace]` records, and either pretty-prints a sorted text timeline or
emits Chrome Trace Format JSON for Perfetto.

The text mode is the path I expect to use most — it's a column-aligned
table sorted by start time, with subprocess totals and an
externally-measured wall (`spawn → wait`) so the unobserved
prelude/epilogue is visible:

```
ts(ms)  dur       tid  kind  name
0.000   11µs      1    span  init_logging
0.043   3.979ms   1    span  prewarm
0.058   3.882ms   1    cmd   git rev-parse --git-common-dir … HEAD [wt-perf-typical-1]
…

3 subprocesses totaling 11.315ms (slowest: 3.882ms git rev-parse … HEAD)
traced: 14.838ms (first → last [wt-trace] record)
wall:   19.367ms (spawn → wait; +4.529ms untraced prelude/epilogue)
```

## What's in the diff

- **`tests/helpers/wt-perf/src/main.rs`** — new `Timeline` subcommand.
Resolves `wt` as a sibling of `current_exe()` (Windows-aware via
`EXE_SUFFIX`), optionally invalidates caches with `--cold [--repo
PATH]`, runs `wt` with `RUST_LOG=debug`, captures stderr, and renders.
Uses `tabwriter` for column alignment, `Duration`'s std `Debug` for
compact unit display, and `insta` for inline snapshot tests.
- **`tests/helpers/wt-perf/Cargo.toml`** — new deps: `tabwriter`
(release), `insta` (dev).
- **`CLAUDE.md`** — fixes stale `--skip` syntax in the Benchmarks
section (Criterion takes a positional FILTER, per #2547), replaces the
non-existent `bench_list_by_worktree_count` example, adds a Traces
section.
- **`benches/CLAUDE.md`** — leads "Generating traces" with `wt-perf
timeline`; the manual stderr-redirect pipeline is now framed as the path
for traces from a log already on disk.
- **`src/trace/mod.rs`** module doc — same usage block update so library
doc and CLAUDE.md don't drift.
- **`wt-perf setup`** printed suggestion — hints at `wt-perf timeline`
instead of the manual stderr redirect.

`wt-perf trace` (stdin/file → Chrome JSON) and `wt-perf cache-check` are
unchanged — they still serve the case where you have a captured log and
want to convert or analyze it without re-running.

## Test plan

- [x] `cargo run -- hook pre-merge --yes` (3432 tests, lints, doctests)
passes locally
- [x] `wt-perf timeline -- -C \$REPO stub` end-to-end on a typical-1
fixture
- [x] `wt-perf timeline --cold --repo \$REPO -- -C \$REPO stub`
invalidates and reruns
- [x] `wt-perf timeline --chrome -- -C \$REPO stub` produces valid JSON
(loaded into `python -m json.tool`)
- [x] `cargo test -p wt-perf --bin wt-perf` — 2 inline insta snapshots
pass
- [ ] CI green

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants