perf-compare
Runs stress-test harnesses on local branches and reports performance regressions compared to main.
Install
mkdir -p .claude/skills/perf-compare && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10444" && unzip -o skill.zip -d .claude/skills/perf-compare && rm skill.zipInstalls to .claude/skills/perf-compare
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Benchmark the Reactor data-grid stress harness in the microsoft/microsoft-ui-reactor repo and compare this branch against the `main` baseline. Activate when a contributor asks to "benchmark my changes", "run the perf benchmark", "compare perf vs main", "how much faster/slower is my branch", "did my change regress perf", "check perf before I push", or similar. Builds + runs StressPerf.ReactorOptimized on the current tree and on a clean `main` worktree, interleaved on one machine, captures the four headline metrics (Renders/sec, Avg Reconcile ms, Avg Diff ms, Avg Memory MB), and reports a direction-aware delta table to stdout. Does NOT apply fixes.Key capabilities
- →Benchmark Reactor data-grid harness
- →Compare branch vs main baseline
- →Capture performance metrics
- →Report direction-aware deltas
How it works
It runs the StressPerf.ReactorOptimized harness on the current branch and main, capturing metrics for side-by-side comparison.
Inputs & outputs
When to use perf-compare
- →Benchmarking UI rendering performance
- →Detecting performance regressions
- →Comparing branch performance against main
About this skill
You are the Perf comparison orchestrator for the
microsoft/microsoft-ui-reactor repo. Your job is to give a contributor the
four headline perf numbers for their in-progress branch and an honest delta
against the main baseline — the local equivalent of commenting /perf on
a PR.
Reactor is a declarative, component-based C# framework for building WinUI 3
desktop apps; a reconciler diffs immutable Element records and patches real
WinUI controls. The benchmark workload is the StressPerf.ReactorOptimized
StocksGrid stress harness. Read AGENTS.md (build/test commands, conventions)
and tests/stress_perf/ci/README.md (the full runner doc) before starting.
You drive the committed orchestrator script — do not reimplement the
measurement. Everything you need is in tests/stress_perf/ci/Run-PerfBenchmark.ps1
and PerfLib.ps1. Run it with your powershell tool (pwsh).
When to activate
Trigger phrases include:
- "benchmark my changes" / "run the perf benchmark" / "run the stress harness"
- "compare perf vs main" / "how does my branch compare on perf"
- "how much faster / slower is my branch"
- "did my change regress performance" / "perf regression check"
- "check perf before I push" / "what are my four perf numbers"
Do not activate for unrelated profiling questions, the startup-perf harness
(tests/startup_perf/), or a request to change perf code — this skill only
measures and reports.
The four metrics
Release build (host architecture; x64 on CI runners), StressPerf.ReactorOptimized StocksGrid:
| Metric | Direction |
|---|---|
| Renders/sec | higher is better ↑ |
| Avg Reconcile (ms) | lower is better ↓ |
| Avg Diff (ms) | lower is better ↓ |
| Avg Memory (MB) | lower is better ↓ |
StressPerf.Direct (vanilla WinUI3, imperative) has no virtual-DOM, so it has no
reconcile/diff phase — those read n/a.
Workflow
1. Preflight
- Confirm
dotnet --version≥ 10 and thatpwshis available. Ifdotnetis missing, stop and tell the user. - Confirm there are changes worth measuring:
git rev-list --count origin/main..HEAD(committed) andgit status --porcelain(uncommitted). If both are empty, tell the user there is nothing to compare and stop. - Capability check. The harness opens a real WinUI window. If you are
running on a headless box, runs will crash with
0xC000027Bduring first-frame window activation. If a first run fails that way, do not keep retrying — report it (see Failure handling).
2. Set up the main baseline worktree
Compare mode needs a second checkout on main:
git fetch origin main
git worktree add ../perf-main origin/main
If ../perf-main already exists, reuse it. Remember to remove it at the end.
3. Run the benchmark (compare mode)
Invoke the orchestrator with the current tree as the PR head and the worktree as
the baseline. Use the methodology defaults; bump -Reps if the user wants
tighter numbers.
pwsh tests/stress_perf/ci/Run-PerfBenchmark.ps1 `
-BaselineRoot ../perf-main `
-Percent 50 -Duration 10 -Reps 2 -Warmup 1
- Build is self-contained by default (
-SelfContained $true) — no machine-wide Windows App SDK runtime install is required. - This interleaves
main/ current-treeReactorOptimizedruns on one machine, runs vanilla WinUI3 once, and writestests/stress_perf/ci/out/result.jsonandtests/stress_perf/ci/out/comment.md. - The run is slow (build + several timed runs). Use a generous timeout and let it finish; do not interrupt it.
For a quick single-tree "just my numbers" request (no baseline), omit
-BaselineRoot:
pwsh tests/stress_perf/ci/Run-PerfBenchmark.ps1
4. Read the results
Parse tests/stress_perf/ci/out/result.json (authoritative): it has main,
pr, and winui3 aggregates (median per metric + <Metric>Spread), plus
runner identity. comment.md is the already-rendered two-table comment if you
prefer to surface it verbatim.
Apply the direction-aware rule per metric (Renders/sec higher-better; the
other three lower-better) and the noise band: a delta whose magnitude is
below the larger of the run-to-run spread and a 4% floor is within noise — not
a win or a regression. (PerfLib.ps1's Get-PerfDelta already encodes this; the
numbers in result.json reflect it.)
5. Report to stdout
Print a concise report — do not edit code, do not post anything to
GitHub (that is the /perf workflow's job). Format:
Perf comparison — <branch> vs main (median of <Reps>, <Warmup> warmup)
Runner: <CPU> · <cores> cores · <RAM> GB
Metric main PR Δ Status
Renders/sec ↑ <m> <p> <+/-x%> <improvement|regression|within noise>
Avg Reconcile (ms) ↓ <m> <p> <+/-x%> ...
Avg Diff (ms) ↓ <m> <p> <+/-x%> ...
Avg Memory (MB) ↓ <m> <p> <+/-x%> ...
Cross-framework (same workload): vanilla WinUI3 <…> · Rust windows-reactor <ref> · Reactor (PR) <…>
Note: absolute numbers are machine-dependent — trust the Δ vs main. Memory is the noisiest metric.
Then one or two plain-language sentences: did this branch improve, regress, or not measurably change perf, and on which metric(s).
6. Clean up
Remove the baseline worktree you created:
git worktree remove ../perf-main
Failure handling
0xC000027B/ no metrics produced. The box cannot composite a real WinUI window (headless / no GPU / RDP without composition). The build and runtime are fine. Tell the user the local box can't run the harness and that the authoritative path is to comment/perfon the PR, which runs on awindows-latestrunner that can composite. Do not loop on retries.- Build failure. Surface the real
dotneterror fromtests/stress_perf/ci/out/build-*.log; do not guess. - One side has no metrics but the other does — report what you have and flag that the comparison is incomplete.
Rules the orchestrator must enforce
- Measure, don't fix. Never edit framework or harness code from this skill.
- Don't post to GitHub. Local stdout only; the sticky PR comment is owned by
.github/workflows/perf-compare.yml. - Drive the committed script. Use
Run-PerfBenchmark.ps1/PerfLib.ps1— do not hand-roll a parallel measurement. - Same-runner A/B only. Never compare a local PR run against a number measured on a different machine or a stored baseline; always run both sides here, interleaved.
- Honor the noise band. Do not call a sub-noise delta an improvement or a regression.
- Trust the delta, not the absolutes, and say so in the report.
Relationship to /perf and the startup harness
- This skill is the local equivalent of the
/perfPR workflow (.github/workflows/perf-compare.yml); both use the same scripts and render the same comparison. Use this before pushing; use/perffor the reviewer-visible comment on the PR. The workflow publishes that rendered comparison only when the benchmark run completes successfully; on a failed or incomplete run it posts a neutral fallback comment linking the run log instead. - It is unrelated to the startup perf harness under
tests/startup_perf/(ETW/WPR TTFP/TTI measurement) — do not invoke that here.
When not to use it
- →Profiling unrelated code
- →Changing performance code
Prerequisites
Limitations
- →Requires GPU/composition support
- →Requires manual cleanup of worktrees
How it compares
This provides a standardized, local performance comparison workflow compared to manual benchmarking.
Compared to similar skills
perf-compare side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| perf-compare (this skill) | 0 | 1mo | No flags | Advanced |
| performance-benchmark | 3 | 4mo | No flags | Intermediate |
| csharp-pro | 9 | 4mo | No flags | Intermediate |
| backend-testing | 3 | 1mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by microsoft
View all by microsoft →You might also like
performance-benchmark
dotnet
Generate and run ad hoc performance benchmarks to validate code changes. Use this when asked to benchmark, profile, or validate the performance impact of a code change in dotnet/runtime.
csharp-pro
sickn33
Write modern C# code with advanced features like records, pattern matching, and async/await. Optimizes .NET applications, implements enterprise patterns, and ensures comprehensive testing. Use PROACTIVELY for C# refactoring, performance optimization, or complex .NET solutions.
backend-testing
exceptionless
Backend testing with xUnit, Foundatio.Xunit, integration tests with AppWebHostFactory, FluentClient, ProxyTimeProvider for time manipulation, and test data builders. Keywords: xUnit, Fact, Theory, integration tests, AppWebHostFactory, FluentClient, ProxyTimeProvider, TimeProvider, Foundatio.Xunit, TestWithLoggingBase, test data builders
dotnet-dev
GitTools
Expert guidance for .NET development in this repository. Use this skill for building, testing, debugging, and understanding project structure, coding conventions, dependency injection patterns, and testing practices.
mutation-testing
SebastienDegodez
Use when running mutation testing, killing mutants, verifying test quality, checking mutation score, or analyzing survivors after the test baseline is green
dotnet-native-aot
rudironsoni
>-