/ronce-racine:performance-profilingfrom Ronce Racine
Guides systematic performance investigation: measure before and after changes, identify bottlenecks via profiling, and avoid common pitfalls like optimizing irrelevant code or misreading noise.
Ships in Ronce Racine. 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.
Read when SKILL.md points to them.
If the current repo has its own performance skill or a documented benchmark harness, it wins - it knows the representative workload, which is the hardest part to get right.
No optimization without a measurement that precedes it and a measurement that follows it. The output of this skill is not faster code - it is a demonstrated, quantified, reproducible difference. A campaign that refutes its own hypotheses is a success; one that confirms every hunch is a warning sign.
Three failures account for most wasted performance work, and the protocol below exists to prevent them:
Makefile, package.json,
bench/, CI config before writing anything new.- [ ] 0. State the question and the numeric success criterion
- [ ] 1. Stabilize the bench and measure the noise floor
- [ ] 2. Macro profile under representative load - before any micro work
- [ ] 3. Read the profile: self vs cumulative, apply Amdahl
- [ ] 4. Check off-CPU as well as on-CPU
- [ ] 5. Add labels/zones to make the profile queryable
- [ ] 6. Narrow down by dichotomy (ablation / bisection / bracketing)
- [ ] 7. One falsifiable hypothesis + the micro-benchmark that isolates it
- [ ] 8. A/B honestly: interleaved, count>=10, delta read against the noise floor - p-value when the harness computes one
- [ ] 9. Re-measure at macro level - a micro gain invisible at macro is not a gain
- [ ] 10. Lock it in with a CI regression guard
Write both down before touching a profiler. The criterion decides when you stop - without it, a performance campaign expands until someone gets bored.
Run the unmodified code twice and compare the two runs. The difference is your noise floor: no effect below it can be claimed, on this machine, today.
Close competing workloads, check the load average, prefer a fixed CPU governor. If the machine cannot be quiet, do not abandon the campaign - pivot to metrics that resist noise: allocation counts, retained heap, object counts, instruction counts. They answer many questions and barely move under load.
Details and thresholds: reference/statistics.md.
Profile the whole system under representative load first. Micro-optimizing before the macro profile is the most expensive mistake in this protocol, because it is invisible: the code gets faster and the program does not.
self (own instructions) vs cumulative (self + callees). Optimize on self, navigate on cumulative.
Then apply Amdahl before writing any code: a function at 8% cumulative caps the achievable gain at 8%. Compute that ceiling and decide whether the work is worth it - this single step kills most bad optimization ideas for free.
Watch for Gregg's street light anti-method: profiling the component you know how to profile rather than the one holding the time.
A CPU profile shows time on the CPU. It cannot show waiting - locks, channels, syscalls, scheduler starvation. Flat CPU with rising latency is the signature, and a CPU profile will happily show you a plausible, irrelevant hot spot.
Get the block/mutex profile, the execution trace, or an off-CPU flame graph. If per-operation cost rises with parallelism, you are serialized, not slow.
Attach the dimension you will want to slice by - tenant, endpoint, job kind, pipeline stage - so the profile becomes queryable:
pprof.Do + pprof.Labels, then -tagfocusZoneText/ZoneValueWithout labels a profile says "JSON decoding is 30%". With them: "30%, and 27 points of it are one tenant". Instrument phases first, descend only into the phase that is over budget - instrumenting everything produces an unreadable timeline and real overhead.
Three complementary forms:
git bisect run driven by a performance predicate to find the
commit that introduced a regression.State it so it can fail: "removing X saves at least N ns/op". Write the smallest benchmark that isolates it, with a control arm. Two changes at once means an uninterpretable result.
-count >= 10, interleave the A and B runs (never all-A then all-B - thermal
drift maps straight onto your comparison), compare with a statistical tool, read
the p-value.
Not every ecosystem gives you a p-value. benchstat does (Mann-Whitney U on
go test -bench output); the JS harnesses this skill recommends - tinybench,
mitata - report ops/s with a relative margin of error or a coefficient of
variation, and no significance test at all. Where there is no p-value, the claim
is carried by the noise floor from step 1 instead: report the delta, the sample
count, and the noise floor measured on the same machine the same day, and claim
nothing whose delta does not clear that floor. That is the same decision the
p-value makes, from the measurement you already had to take. What is never
acceptable is a claim with neither - a delta with no p-value and no noise floor
is an anecdote.
Never re-run until it becomes significant. At p<0.05 one run in twenty is significant by chance; re-rolling manufactures exactly that false positive. "No measurable effect" is a valid, publishable result.
Take the macro measurement from step 2 again. A micro gain that does not show up at macro level was either irrelevant (Amdahl) or noise. Report the macro number, not the micro one.
A gain with no regression guard is reclaimed within months. Add a CI comparison against the base branch with a loose threshold (10-20%): a flaky performance gate gets disabled, which is worse than no gate.
Report one line per hypothesis, and make the verdict explicit:
### H<n> - <hypothesis stated so it can fail>
| | |
|---|---|
| **Verdict** | confirmed / refuted / inconclusive |
| **Measured** | <numbers, with units and sample count> |
| **Significance** | n=<samples>, noise floor <x>%, p=<value> where the tool computes one |
| **Command** | `<verbatim, re-runnable>` |
| **Consequence** | <what this changes - or explicitly: nothing> |
| Excuse | Reality |
|---|---|
| "It is obviously the N+1 query / the regex / the lock" | Obvious causes are wrong often enough that measuring costs less than being wrong. Profile first. |
| "I will profile after making the obvious fixes" | Then you will never know whether the fix did anything, and you will keep it forever regardless. |
| "The micro-benchmark shows +30%" | On what fraction of total time? A 30% gain on 2% of runtime is 0.6%. Compute Amdahl before celebrating. |
| "CPU is at 100%, so it is CPU-bound" | It can be spinning on a lock or thrashing GC. Check off-CPU before rewriting the algorithm. |
| "The machine is a bit busy but the delta is huge" | Then measure the noise floor and show the delta exceeds it. If it does, fine - that takes five minutes. |
"benchstat says ~, let me run it again" | That is multiple testing. Decide the sample count in advance; ~ is the answer. |
| "No time to set up a control" | Without a control you have a number, not a result. The control is usually the same command minus one flag. |
| "I will measure it in production later" | You will not, and by then three other changes will have shipped. |
| "The profiler overhead distorts everything" | ~5-10% for CPU sampling, uniformly distributed. It shifts absolute values, not the ranking you are reading. |
| "It is faster on my machine" | One machine, one run, no noise floor, no p-value. That is an anecdote. |
reference/statistics.md - noise floor, interleaving, reading benchstat, multiple testingreference/go.md - pprof (CPU/heap/block/mutex), labels, runtime/trace, escape analysis, PGOreference/node-web.md - --cpu-prof, clinic, heap snapshots, event loop delay, Web Vitalsreference/native.md - perf, flame graphs, differential flame graphs, hardware counters, callgrindreference/tracy.md - when Tracy is the right tool, its MCP server, and when to stay awayWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub charierefiedler/ronce-racine --plugin ronce-racine37 skills in this plugin
/adversarial-feature-challengeUse when a feature is "done" and needs adversarial stress-testing before shipping - "is it really ready", "est-ce vraiment prêt", "find the bugs", "trouve les bugs", "red team", before closing a ticket whose only validation is the golden path passing./api-contract-versioningUse when modifying an API endpoint, schema or contract consumed elsewhere - renaming/removing/restructuring a request or response field, pagination or envelope change, "field X must become", "le champ X doit devenir", introducing a breaking change, versioning an API, or deprecating a field/route. Covers REST, GraphQL and gRPC alike./audit-architectureAudit Architecture, Scalability & Availability. Use when auditing ADRs, interface contracts, coupling, scalability, resilience patterns, SLA/RPO/RTO, high availability, or incident management. Triggers on "audit architecture", "audit archi", "audit scalabilité", "audit scalability", "audit disponibilité", "audit availability", "audit résilience", "audit resilience", "audit incidents"./audit-ci-cdAudit CI/CD & Release Management. Use when auditing pipelines, deployment strategies, DORA metrics, IaC, artifact management, or supply chain security. Triggers on "audit ci", "audit pipeline", "audit déploiement", "audit deployment", "audit release"./audit-complianceCompliance, Data Governance & FinOps audit. Use when auditing GDPR compliance, data governance, data retention, consent management, FinOps, or regulatory requirements. Triggers on "audit conformité", "audit compliance", "compliance audit", "audit RGPD", "audit GDPR", "audit données", "audit data governance", "audit finops", "audit gouvernance"./audit-industrialisationFull software-industrialisation audit. Orchestrates the 8 domain audits and produces a consolidated report. Use when running a full audit of a project's software engineering maturity. Triggers on "audit industrialisation", "industrialisation audit", "audit complet", "full audit", "audit projet", "project audit", "audit maturité", "maturity audit", "audit global", "global audit".Other plugins' skills for the same job