Python performance
Python performance workflow for profiling, benchmarking, and optimizing CPU, memory, I/O, async, database, and data-processing hotspots with before/after measurements.From its SKILL.md
npx -y skills add nyquistwilder/personal-pi --skill python-performanceAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.9 KB, 520 tokens by cl100k_base, as published. Nobody here has run it
Python Performance
Rule
Optimize only with evidence. Measure before and after meaningful changes, preserve correctness, and prefer algorithmic or I/O-boundary improvements over micro-optimization.
Use this skill for performance investigation and optimization, not speculative cleanup.
Hard Stops
Stop and ask before optimizing when:
- The performance goal, workload, dataset size, latency/throughput target, or resource limit is unclear.
- Measurement would require production data, live systems, secrets, or destructive load.
- Proposed changes trade away correctness, security, or public contracts.
- Benchmark results would be dominated by network, database, filesystem, or external service noise without an agreed test strategy.
- Adding specialized dependencies or native extensions is being considered without approval.
Measurement Defaults
- Start with a representative workload and a baseline number.
- Include correctness tests before optimizing non-trivial logic.
- Measure wall time, CPU, memory, allocations, I/O, and query counts as relevant.
- Use
time.perf_counter()for simple local timing and profilers for deeper analysis. - Keep benchmarks deterministic enough to compare; document hardware/data caveats.
- Avoid claiming speedups from single noisy runs.
Optimization Priorities
- Remove unnecessary work, repeated parsing, redundant I/O, and avoidable allocations.
- Improve algorithms and data structures.
- Batch network, filesystem, database, and serialization operations.
- Use streaming for large data rather than loading everything into memory.
- For tabular data, consider Polars, PyArrow, or DuckDB when they fit the workload and are approved dependencies.
- Use async/concurrency only for I/O-bound work with clear lifecycle and cancellation rules.
- Micro-optimize hot loops only after profiling proves they matter.
Workflow
- Define the performance target and representative workload.
- Run existing correctness tests.
- Capture baseline measurements and profiler output.
- Identify the bottleneck and choose the smallest safe intervention.
- Implement the optimization with tests or benchmarks that guard against regression.
- Measure again under the same conditions.
- Run repository validation.
Review Guidance
Flag unmeasured performance claims, benchmark data that does not match production-like workloads, changes that reduce clarity for negligible gain, hidden memory blowups, N+1 I/O, missing timeouts, and concurrency that lacks cancellation or cleanup.
Completion
Report baseline and after measurements, workload used, bottleneck found, optimization made, correctness tests run, validation commands, and remaining performance risks.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.