python-performance-optimization
Skill2 starsChanged 3 months agoMITView on GitHub
Profile and optimize Python code using cProfile, memory profilers, and performance best practices. Use when debugging slow Python code, optimizing bottlenecks, or improving application performance.
27 other projects use a version of this, 27 of them edited.
Adopted by
Most recently taken up by
- gromov0737/skillsedited, first seen Nov 29, 2026
- hybridlabor-api/aosedited, first seen Nov 29, 2026
- AtilaMedeiros/skillsedited, first seen Nov 16, 2026
- FimawLLC/fimaw-skillsedited, first seen Nov 15, 2026
- Rvey/agent-engineering-kitedited, first seen Nov 11, 2026
- zebbern/pocmapedited, first seen Nov 8, 2026
Used with
Projects with it also use python-resource-management, python-anti-patterns and 8 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
Aver005Skillpython-resource-management
Python resource management with context managers, cleanup patterns, and streaming. Use when managing connections, file handles, implementing cleanup logic, or building streaming responses with accumulated state.
Also in 4 projects that use this
CodeWithBehnamSkillpython-anti-patterns
Common Python anti-patterns to avoid. Use as a checklist when reviewing code, before finalizing implementations, or when debugging issues that might stem from known bad practices.
Also in 5 projects that use this
miketropiSkillnextjs-react-typescript
Expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI and Tailwind
Also in 3 projects that use this
nilecuiSkillasync-python-patterns
Master Python asyncio, concurrent programming, and async/await patterns for high-performance applications. Use when building async APIs, concurrent systems, or I/O-bound applications requiring non-blocking operations.
Also in 5 projects that use this
justanestaSkillpython-error-handling
Python error handling and debugging. Use this skill when implementing error handling, designing exception hierarchies, debugging issues, or adding logging. Covers exception patterns, custom exceptions, logging with structlog, debugging tools, and error recovery.
Also in 3 projects that use this
CodeWithBehnamSkillpython-type-safety
Python type safety with type hints, generics, protocols, and strict type checking. Use when adding type annotations, implementing generic classes, defining structural interfaces, or configuring mypy/pyright.
Also in 3 projects that use this
Other versions27 projects use a version of this.
Word for word · 0
None found.
Edited · 27
- jewbetcha/openflight★ 1.2k12% same
- hybridlabor-api/aos★ 932% same
- xfstudio/skills★ 953% same
- ControllableModel/SWE-Skills-Bench★ 812% same
- VoVuongThanhDat/agentflow★ 812% same
- zebbern/pocmap★ 799% same
- AJBcoding/claude-skill-eval★ 412% same
- GPTtang/skill-atlas★ 412% same
- zebbern/termstack★ 427% same
- FimawLLC/fimaw-skills★ 399% same
17 more not listed
Wrote their own version · 0
None found.
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 repository62 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- site/llms.txtllms.txt
- adrSkill
- autopilot-async-monitoringSkill
- changelog-automationSkill
- ci-temporary-bypassSkill
- codebase-designSkill
- create-architectural-decision-recordSkill
- create-specificationSkill
- documentation-writerSkill
- gha-watch-ci-prSkill
- grill-with-docsSkill
- hardenSkill
- i-have-an-issueSkill
- improve-codebase-architectureSkill
- issue-implementSkill
- issue-selectSkill
- issue-to-planSkill
- next-milestoneSkill
- process-error-postmortemSkill
- pycc-feedbackSkill
- pyccSkill
- python-design-patternsSkill
- python-performance-optimizationSkill
- python-testing-patternsSkill
- review-findingsSkill
- rust-async-patternsSkill
- sessionsSkill
- tddSkill
- testing-strategySkill
- todoSkill
- ultra-reviewSkill
- adrSkill
- autopilot-async-monitoringSkill
- changelog-automationSkill
- ci-temporary-bypassSkill
- codebase-designSkill
- create-architectural-decision-recordSkill
- create-specificationSkill
- documentation-writerSkill
- gha-watch-ci-prSkill
- grill-with-docsSkill
- hardenSkill
- i-have-an-issueSkill
- improve-codebase-architectureSkill
- issue-implementSkill
- issue-selectSkill
- issue-to-planSkill
- next-milestoneSkill
- process-error-postmortemSkill
- pycc-feedbackSkill
- pyccSkill
- python-design-patternsSkill
- python-testing-patternsSkill
- review-findingsSkill
- rust-async-patternsSkill
- sessionsSkill
- tddSkill
- testing-strategySkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. 2 are common, 4 are distinctive, and 0 are very specific to this project.
2
Common
Most of the 27 edited versions we read keep these.
4
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
- Common: line 48
Caching: Avoid redundant computation
- Common: line 90
Cache expensive computations: - Use lru_cache
- Distinctive: line 94
Profile production code: - Use py-spy for live systems
- Distinctive: line 100
Not using appropriate data structures
- Distinctive: line 102
Not using connection pooling for databases
- Distinctive: line 105
Not considering memory usage
“Common” is measured: kept by at least 6 in 10 of the 27 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
<!-- ievo:start -->Before applying the instructions below, read .ievo/evolution/skills/python-performance-optimization.md
if it exists and apply all rules from its sections.
<!-- ievo:end -->Python Performance Optimization
Comprehensive guide to profiling, analyzing, and optimizing Python code for better performance, including CPU profiling, memory optimization, and implementation best practices.
When to Use This Skill
- Identifying performance bottlenecks in Python applications
- Reducing application latency and response times
- Optimizing CPU-intensive operations
- Reducing memory consumption and memory leaks
- Improving database query performance
- Optimizing I/O operations
- Speeding up data processing pipelines
- Implementing high-performance algorithms
- Profiling production applications
Core Concepts
1. Profiling Types
- CPU Profiling: Identify time-consuming functions
- Memory Profiling: Track memory allocation and leaks
- Line Profiling: Profile at line-by-line granularity
- Call Graph: Visualize function call relationships
2. Performance Metrics
- Execution Time: How long operations take
- Memory Usage: Peak and average memory consumption
- CPU Utilization: Processor usage patterns
- I/O Wait: Time spent on I/O operations
3. Optimization Strategies
- Algorithmic: Better algorithms and data structures
- Implementation: More efficient code patterns
- Parallelization: Multi-threading/processing
- Caching: Avoid redundant computation
- Native Extensions: C/Rust for critical paths
Quick Start
Basic Timing
import time
def measure_time():
"""Simple timing measurement."""
start = time.time()
# Your code here
result = sum(range(1000000))
elapsed = time.time() - start
print(f"Execution time: {elapsed:.4f} seconds")
return result
# Better: use timeit for accurate measurements
import timeit
execution_time = timeit.timeit(
"sum(range(1000000))",
number=100
)
print(f"Average time: {execution_time/100:.6f} seconds")Detailed patterns and worked examples
Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
Best Practices
- Profile before optimizing - Measure to find real bottlenecks
- Focus on hot paths - Optimize code that runs most frequently
- Use appropriate data structures - Dict for lookups, set for membership
- Avoid premature optimization - Clarity first, then optimize
- Use built-in functions - They're implemented in C
- Cache expensive computations - Use lru_cache
- Batch I/O operations - Reduce system calls
- Use generators for large datasets
- Consider NumPy for numerical operations
- Profile production code - Use py-spy for live systems
Common Pitfalls
- Optimizing without profiling
- Using global variables unnecessarily
- Not using appropriate data structures
- Creating unnecessary copies of data
- Not using connection pooling for databases
- Ignoring algorithmic complexity
- Over-optimizing rare code paths
- Not considering memory usage
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.

