python-performance
Skill4 starsChanged 2 months agoApache-2.0View on GitHub
Profile, benchmark, or optimize Python CPU, latency, throughput, allocations, startup, or native-call overhead. Requires a representative workload; not a blanket rewrite into Rust.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- dmoreq/agent-grimoiretheir own version, first seen Nov 8, 2026
- rafaelh/skillstheir own version, first seen Nov 4, 2026
- Lu1sDV/skillsmdtheir own version, first seen Nov 1, 2026
- justanesta/claude-code-resourcestheir own version, first seen Jan 20, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- justanesta/claude-code-resources★ 2same name
- Lu1sDV/skillsmd★ 2same name
- rafaelh/skills★ 2same name
- dmoreq/agent-grimoire★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository81 other files it gives its agents.
- agent-cli-designSkill
- agent-tool-boundariesSkill
- behavior-first-implementationSkill
- bounded-prototypeSkill
- bounded-pr-sliceSkill
- building-fdd-validationSkill
- context-efficiencySkill
- cross-language-contractsSkill
- cross-platform-agent-instructionsSkill
- design-interviewSkill
- diagnosis-loopSkill
- domain-languageSkill
- edge-cloud-syncSkill
- handoff-continuitySkill
- immutable-pr-reviewSkill
- memory-context-hygieneSkill
- module-designSkill
- orchestrateSkill
- owner-decision-gateSkill
- parallel-portfolioSkill
- pr-gate-loopSkill
- pyo3-async-lifecycleSkill
- pyo3-buffer-performanceSkill
- pyo3-free-threadingSkill
- pyo3-ownership-errorsSkill
- pyo3-wheel-releaseSkill
- python-api-typingSkill
- python-async-concurrencySkill
- python-ci-releaseSkill
- python-data-boundariesSkill
- python-packaging-environmentsSkill
- python-pytestSkill
- python-reviewSkill
- python-test-designSkill
- python-threading-workersSkill
- python-workflowSkill
- react-components-stateSkill
- react-performanceSkill
- repository-groundingSkill
- rust-api-designSkill
- rust-async-concurrencySkill
- rust-build-diagnosticsSkill
- rust-ci-releaseSkill
- rust-memory-layoutSkill
- rust-nextestSkill
- rust-numerics-simdSkill
- rust-performanceSkill
- rust-protocol-codecsSkill
- rust-python-bindingsSkill
- rust-reviewSkill
- rust-storage-durabilitySkill
- rust-test-designSkill
- rust-unsafe-ffiSkill
- rust-workflowSkill
- rust-workspace-dependenciesSkill
- shadcn-react-componentsSkill
- shadcn-svelte-componentsSkill
- simplify-existing-codeSkill
- source-verificationSkill
- svelte-components-runesSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
Remove repeated work and unnecessary protocol crossings first.
- Distinctive: line 27
Run correctness tests before and after.
- Distinctive: line 29
Read measurement notes for the boundary-specific questions.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Python Performance Engineering
Define the user-visible workload and correctness contract first. Identify whether the bottleneck is Python execution, object conversion, native compute, I/O, queuing, startup, or memory retention. Reuse an existing benchmark before adding another framework.
Establish a comparable baseline
Record the interpreter/build variant, GIL state after imports, extension build mode, relevant dependencies, input size, concurrency, and warm/cold conditions. Compare on the same native host without other benchmark or compilation jobs. Do not compare a debug extension to a release extension and attribute the difference to a code change.
Use a profiler to locate cost, then measure without profiling overhead. Standard-library cProfile and tracemalloc can answer Python questions, but Python allocation tracing does not automatically account for Rust Vec/Arc/allocator memory. Use native profiling or process-level measurements when the cost crosses that boundary, and distinguish live objects, allocator retention, mapped memory, and RSS.
Prefer a representative end-to-end case plus a focused microbenchmark. Use pyperf when already available or justified for repeated measurements; retain raw output and inspect instability. A single fastest timing, or an average with failures omitted, is not evidence. Measure completed operations and include error rate, payload shape, queue depth, and tail latency where relevant. Do not run privileged system tuning without explicit authorization.
Optimize in a useful order
Remove repeated work and unnecessary protocol crossings first. Consider batching, parsing once, fewer intermediate objects, better algorithms, bounded caching, and reusing connections. Check retained memory and latency tradeoffs: streaming can defer errors, batching can delay small requests, and caching can serve stale data.
At a Rust boundary measure Python conversion, native computation, and result construction separately. Replacing many small calls with one batch may matter more than a faster kernel. Avoid unsafe zero-copy, unconditional detachment, wholesale vectorization, new allocators, or a Rust rewrite without measured need.
For free-threading, measure both single-call overhead and realistic parallel scaling. Bound Python workers, Rust/Tokio/Rayon workers, and any numerical-library pools as one CPU budget. Independent processes or fewer threads may outperform nested parallelism; measure rather than prescribe.
Run correctness tests before and after. Report baseline/candidate measurements, variance, relevant regressions, and one of keep, reject, or inconclusive. Microbenchmark improvement is not a product-wide speedup.
Read measurement notes for the boundary-specific questions.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

