python-performance
Installation
SKILL.md
Python Performance
This skill is measurement-first optimization in CPython.
If the task is idioms, typing, or packaging, use python-patterns. If it is asyncio orchestration, use python-async-patterns. Primitive choice (which executor, queue shutdown, start method) lives in python-patterns concurrency.md; this skill is cost, GIL, and measurement.
When to activate
- Confirming a latency, throughput, CPU, or memory regression in Python
- Deciding whether threads, processes, subinterpreters, or a free-threaded build will actually parallelize
- Profiling a hot path before and after a change
- Evaluating experimental JIT or other runtime knobs
Rules of engagement
- Profile before changing code. Algorithm and I/O dominate micro-tweaks.
- Change one variable at a time. Keep a before/after number.
- Optimize the proven hot path, not code that merely looks slow.
- Do not treat free-threading or the JIT as default. Both are opt-in; JIT is experimental.