performance-optimization

Diagnose and optimize application performance using profiling, benchmarking, and latency analysis.

Updated Dec 29, 2025
One-click install
npx skills add https://github.com/snoodleboot-io/discrecontinual_equations --skill performance-optimization-snoodleboot-io
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: performance-optimization
Source: https://github.com/snoodleboot-io/discrecontinual_equations/tree/main/.claude/skills/performance-optimization
Command: npx skills add https://github.com/snoodleboot-io/discrecontinual_equations --skill performance-optimization-snoodleboot-io

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Engineers often waste weeks optimizing the wrong code because intuition about performance is unreliable. This Skill enforces a measurement-first workflow: profile before optimizing, define concrete latency targets, and verify every change with honest benchmarks. ## Core Features & Use Cases - Profiling Guidance: Covers sampling profilers (py-spy), deterministic profilers (cProfile), line profilers (kernprof), and flame graph interpretation to find the true hotspot. - Target Definition & Amdahl's Law: Helps state goals as percentile + load + workload, and computes the speedup ceiling before committing to a rewrite. - Tail Latency & Benchmarking: Explains p50/p95/p99 analysis, tail amplification in fan-out systems, and how to write warmed, repeated benchmarks at production data volume. - Use Case: A checkout endpoint has a 300 ms p99 budget. Use this Skill to profile the request, find that an auth lookup exceeds its budget, fix the N+1 query pattern, and record before/after numbers in the PR. ## Quick Start Ask the assistant to profile a slow Python endpoint and produce an optimization plan with a latency target and before/after benchmark measurements.

Frequently Asked Questions about performance-optimization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I profile a Python application to find performance bottlenecks?▼

Use a sampling profiler like py-spy for production processes with 1-5% overhead, or cProfile locally for exact call counts. Read the resulting flame graph by width, not depth: the widest plateau is your optimization target.

What is the difference between a sampling profiler and a deterministic profiler?▼

Sampling profilers like py-spy periodically snapshot the stack with minimal overhead, suiting production use. Deterministic profilers like cProfile record every call exactly but slow execution 2-10x, making them better for local analysis of known hot functions.

Why should I measure p99 latency instead of average response time?▼

Averages hide tail behavior: a 60 ms mean is consistent with 1% of requests taking 2.5 seconds. In fan-out systems making 100 backend calls, a p99 event becomes a 63% page-level event, so users experience the tail, not the mean.

When should I add caching to improve performance?▼

Cache only after profiling confirms the hot path, when reads greatly outnumber writes, computation is expensive, and staleness is tolerable. Always measure the hit rate; a 40% hit rate can be worse than no cache once latency and invalidation bugs are counted.

Why is my optimization not speeding up the overall system?▼

Amdahl's Law bounds total speedup by the optimized component's share of runtime: a 10x faster component that uses 5% of total time yields only 1.05x overall. Re-profile after each fix, since the ranking of contributors changes once the top one is removed.