Benchmark Performance Review
Overview
Use this skill to verify that CaseDash performance still matches the maintained machine-specific benchmark ranges, then fix repeatable regressions with measured, narrowly scoped changes.
Required Context
- Read
AGENTS.md. - Read
docs/profile_benchmark.mdbefore forming conclusions. Treat it as the source of truth for benchmark commands, shared hotspot models, kept optimizations, rejected experiments, and practical guidance. - Read the matching
docs/performance/<machine>.mdfile for the current machine's benchmark ranges, bottlenecks, and research directions. - Read
docs/build.mdfor build and validation entrypoints. - Read relevant architecture docs before changing subsystem boundaries:
docs/architecture.mddocs/architecture/*.mdfor the touched package
- Read owning behavior docs before changing user-visible behavior, diagnostics output, provider behavior, layout-edit behavior, or layout-guide-sheet behavior.
Baseline Review
- Inspect
git status --short; ignore unrelated dirty work and do not revert changes made by others. - Build a fresh benchmark executable:
.\build.cmd /benchmarks
- Run every maintained direct benchmark listed in the
Benchmark Workflowsection ofdocs/profile_benchmark.mdsequentially from the fresh build. Do not duplicate the command list here;docs/profile_benchmark.mdis the owning source of truth.
- Compare direct-run timing lines with the current known range in the matching
docs/performance/<machine>.mdfile. Compare like with like: primary loop metrics, named submetrics, same benchmark name, same iteration count, and same warmup count. - Treat a single noisy run as inconclusive. When a metric looks slow, rerun the same direct benchmark at least twice and compare the median or the stable range.
- Treat a regression as actionable when the primary loop metric or an important submetric is repeatably worse than the documented current range beyond normal noise, especially when a hot UI-path metric moves by roughly
10%or more, a guide-sheet metric moves by several milliseconds, or the regression changes the known hotspot shape. - Use direct
build\CaseDashBenchmarks.exeruns as the repeatable baseline. Useprofile_benchmark.cmdtimings only as profiler-instrumented confirmation, not as the baseline comparison.
Regression Investigation
- Isolate the changed benchmark and the first metric that moved. Prefer the smallest repeatable direct benchmark loop while investigating.
- Review the matching machine file under
docs/performance/and the shared sections indocs/profile_benchmark.md:
Shared Hotspot ModelKept OptimizationsResearch JournalPractical Guidance For Future Experiments
- Do not retry experiments that the log rejects unless surrounding code changed enough to make the old result stale. Record why the retry is justified.
- Capture a benchmark-focused profile when direct runs show a material regression or when hotspot attribution is needed. Use the matching
profile_benchmark.cmdcommand documented in theBenchmark Workflowsection ofdocs/profile_benchmark.md.
- For repeated unattended profiling, start the elevated daemon once with
.\profile_benchmark.cmd /daemon-start, then issue ordinaryprofile_benchmark.cmd <benchmark> ...requests. - Prefer fixes that reduce real hot-path work, preserve the documented benchmark harness semantics, and keep benchmark-sensitive code on the maintained Release optimization profile.
- Keep custom hash tables or similar low-level performance utilities in separate owning
.h/.cppmodules, not embedded in large renderer, provider, or controller files.
Fix Discipline
- Change one coherent hypothesis at a time.
- Keep edits scoped to the owning subsystem and the regressed benchmark path.
- Preserve user-visible behavior unless the user explicitly asks for a behavior change; update the owning behavior docs when behavior changes.
- Rebuild and rerun the affected benchmark after each serious experiment.
- If an experiment regresses, is neutral without improving code clarity, or contradicts the benchmark log, revert only your own experiment changes and record the rejected shared result in
docs/profile_benchmark.md. - Keep retained optimizations only when direct benchmark data supports them and the final validation set remains healthy.
- Add concise comments only where a non-obvious code shape preserves a measured performance invariant.
Final Validation
- Run
.\format.cmd changedafter C++ edits; use.\format.cmd fix changedif formatting needs repair. - Run
.\build.cmd /benchmarksafter the final retained changes. - Rerun all maintained direct benchmarks listed in
docs/profile_benchmark.mdafter the final build. - Run
.\test.cmdwhen production behavior, shared logic, or benchmark harness behavior changes. - Run the smallest headless diagnostics command from
docs/diagnostics.mdwhen a fix touches diagnostics, rendering exports, app icon generation, layout-edit output, provider behavior, config reload, or layout-guide-sheet behavior. Put explicit outputs underbuild\and add/default-configwhen exercising built-in config.
Documentation
Update the matching docs/performance/<machine>.md file when:
- A benchmark range changes and the new result becomes the maintained current-tree range.
- A current bottleneck or machine-specific research direction changes.
Update docs/profile_benchmark.md when:
- A retained optimization changes benchmark performance or hotspot shape.
- A rejected or reverted experiment should not be repeated.
- A new recurring performance pitfall is discovered.
Keep entries present-tense and concise. Record commands, representative timing lines, hotspot evidence when used, retained or rejected conclusion, and the reason the result matters.
Update other maintained docs only when behavior, commands, architecture boundaries, diagnostics contracts, provider requirements, or build validation rules change.
Output
Summarize:
- Build command and benchmark commands run.
- Baseline comparison for every benchmark, including any repeated noisy runs.
- Regressions found, root cause, and files changed.
- Final benchmark timing lines and whether they are within or better than the maintained range.
- Profiling evidence used, if any.
- Docs and validation commands run.