/testing-plugin:benchmark-controlsfrom testing-plugin
Identifies and mitigates benchmark control hazards: mutated controls, disagreeing harnesses, VM lock scaling, and hyperfine export parsing. Use when A/B testing or comparing timings.
Ships in testing-plugin. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A benchmark comparison discriminates only while its control stays the condition it was chosen to represent. Four routes take that away without any error: the fixture step edits the control, the timing harness is itself a variable, the machine magnifies the effect being measured, or the parser reads the wrong column.
| Use this skill when... | Use something else when... |
|---|---|
Timing a code change against a baseline (A/B, before/after, branch vs main) | Baselining a Mac's hardware health → macos-plugin:macos-performance-benchmark |
| Building benchmark fixtures from an existing data set | Load-testing an HTTP service → networking-plugin:http-load-testing |
Two timing tools (hyperfine, a shell loop, /usr/bin/time) report different numbers for one command | The comparison is a correctness harness pinned to a moving baseline → the sibling rule cited under Related |
A step that builds a fixture from the control data set can change the
control's own state: reflinks, hard links, chmod, atime, warmed caches. The
control then measures the condition it was meant to exclude, and nothing in the
result says so.
Observed 2026-10 (dust
--shared-blocks, XFS). The "shared" set was built withcp -a --reflink=always ~/.rustup/toolchainsbefore timing, which turned the "unshared" control~/.rustup(198,319 files) into reflinked inodes. It was reported as "nothing shared":--shared-blocks769.4 ms vs master 96.6 ms (8.0x). A never-reflinked tree,/usr/share(128,365 files), measured 126.3 vs 66.0 ms (1.9x), and the PR's numbers were corrected. Unverified: whether XFS keeps an inode's reflink flag after the copies are deleted.
Before trusting either number:
Observed 2026-10 (dust, Linux desktop, kernel 6.17, cpufreq governor
powersave).hyperfine -Nmeasured the lock-bound case at ~740 ms; a plain bash loop timing the same command measured ~520 ms, consistently when the two alternated. Single/usr/bin/timeruns agreed with the loop (0.49–0.60 s). On the non-blocking baseline the methods were within ~6%, and on macOS within ~2% for every case. Cause not established; scheduling sensitivity of a lock convoy is an unproven hypothesis.
Lock contention and thread-scaling results from a desktop-hypervisor VM (OrbStack on the Apple Virtualization framework) are provisional. There a contended spinlock can make throughput fall as threads are added, where bare metal shows only a plateau, so the gain from removing the lock is overstated.
Observed 2026-11 (dust,
open+closeacross threads). On an OrbStack VM with 13 vCPUs, throughput fell past 4 threads. The process-wide fd-table spinlock (files->file_lock) took the paravirtual qspinlock slow path on 99.9% of acquisitions at 13 threads, with 4–8 µs handoff peaks. On bare metal (Ryzen 9 3900X, 24 threads) and on a GCPn2-standard-8KVM guest, which also enables PV spinlocks, the same lock only capped throughput. Removing it measured 2.1–2.5× on OrbStack, 10–11% on bare metal and about 3.5% on GCP. The lock cost 45 of 75 ms on OrbStack, 10 of 73 ms on bare metal and 4 of 99 ms on GCP. PV spinlocks alone do not explain the difference, since the GCP guest has them too.
A parser written against hyperfine 1.x reads 2.x output without an error and gets wrong numbers. Both export formats changed in 2.0.0:
| Export | 1.x | 2.0 |
|---|---|---|
--export-csv header | command,mean,stddev,median,user,system,min,max | command,time_wall_clock_unit,time_wall_clock_mean,…_stddev,…_median,…_min,…_max, then the same six columns for each further metric (memory_peak_resident_* by default) |
| User/system time in CSV | user, system columns | Absent unless selected: --metrics time adds time_cpu_*, time_user_*, time_system_* |
--export-json mean | results[i].mean | results[i].summary.time_wall_clock.mean (schema_version: 2) |
| Per-run times in JSON | results[i].times | results[i].measurements[j].time_wall_clock.value |
s), so a positional parser reports mean=0.0.hyperfine --version, or
schema_version in the JSON. Switching to --export-json alone does not
avoid the change.--shell=none); pass
-S where 1.x shell behaviour is needed, and use the same setting on every
machine compared.Observed 2026-11 (dust benchmarks). A script parsing hyperfine CSV by the 1.x positions printed
mean=0.0under 2.0.0 and raised no error. The header change is confirmed in hyperfine'ssrc/export/csv.rsat v1.18.0, v1.21.0 and v2.0.0, and the JSON change in the v2.0.0 changelog.
~/.claude/rules/validate-adversarial-constructions.md § "A comparison
harness pinned to a moving baseline stops discriminating" covers the case
where the baseline itself moves between runs (a regenerated golden file, a
drift check against main).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub laurigates/claude-plugins --plugin testing-plugin20 skills in this plugin
/measurement-controlsCheck a benchmark, A/B or eval metric measures what it claims: control arms, oracles that can fail, pooled correlations, small x/N. Use when setting up an experiment or a metric says improved./mutation-testingMutation testing with Stryker (TS/JS) and mutmut (Python). Use when finding weak tests that pass on mutated code, or improving test quality through mutation analysis./odiff-image-diffingodiff pixel-by-pixel image diffing. Use when comparing screenshots, detecting visual regressions, diffing before/after PNGs, asserting golden images.Other plugins' skills for the same job