python-performance-optimization
Profile and optimize Python code using cProfile, memory profilers, and performance best practices.
Skill by ollieb89
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/ollieb89-python-performance-optimization
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions: not checked yet.
What's inside
- Skill name
python-performance-optimization- Description
- 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.
- License
- MIT
- Instructions
- 871 lines in SKILL.md · view on GitHub
Before installing
- Instructions call the network
Agent Skills spec issues
- body: 871 lines (spec recommends under 500)
Files (1)
- SKILL.md
SKILL.md (first lines)
# 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
```python
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")
```
## Profiling Tools
### Pattern 1: cProfile - CPU Profiling
```python
import cProfile
import pstats
from pstats import SortKey
def slow_function():
"""Function to profile."""
total = 0
for i in range(1000000):
total += i
return total
def another_function():
"""Another function."""
return [i**2 for i in range(100000)]
def main():
"""Main function to profile."""
result1 = slow_function()
result2 = another_function()
return result1, result2
# Profile the code
if __name__ == "__main__":
profiler = cProfile.Profile()
profiler.enable()
main()
profiler.disable()
# Print stats
stats = pstats.Stats(profiler)
stats.sort_stats(SortKey.CUMULATIVE)
stats.print_stats(10) # Top 10 functions
# Save to file for later analysis
stats.dump_stats("profile_output.prof")
```
**Command-line profiling:**
```bash
# Profile a script
python -m cProfile -o output.prof script.py
# View resultsFrom ollieb89/openrepo, MIT.
More from ollieb89/openrepo
- 0.409score
tailwind-v4-shadcn
ollieb89
Use when installing, configuring, or extending Tailwind CSS v4 with shadcn/ui — covers Turborepo monorepo shared-package architecture, CSS config format…
SkillDFreshness: DClaude Code +9 - 0.406score
shadcn-ui
ollieb89
Provides complete shadcn/ui component library patterns including installation, configuration, and implementation of accessible React components.
SkillDFreshness: DClaude Code +9 - 0.403score
route_directive
ollieb89
Analyzes incoming directives and intelligently routes them to appropriate domain PMs, generic L3 execution, or escalation.
SkillDFreshness: DClaude Code +9 - 0.403score
swarm_query
ollieb89
Read-only cross-project state aggregation for L1 visibility.
SkillDFreshness: DClaude Code +9 - 0.403score
coordinate_parallel
ollieb89
Coordinates execution across multiple domain PMs for cross-domain directives.
SkillDFreshness: DClaude Code +9 - 0.385score
brand-guidelines
ollieb89
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel.
SkillDFreshness: DClaude Code +9 - 0.385score
finishing-a-development-branch
ollieb89
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting…
SkillDFreshness: DClaude Code +9 - 0.384score
dispatching-parallel-agents
ollieb89
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
SkillDFreshness: DClaude Code +9 - 0.384score
executing-plans
ollieb89
Use when you have a written implementation plan to execute in a separate session with review checkpoints
SkillDFreshness: DClaude Code +9 - 0.382score
brainstorming
ollieb89
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior.
SkillDFreshness: DClaude Code +9 - 0.214score
rss-skill
ollieb89
No description from the publisher yet.
SkillDFreshness: DClaude Code +9
Signals
- Stars
- 0
- Forks
- 1
- Open issues
- 0
- Last commit (this folder)
- Mar 5, 2026 (7 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/ollieb89/openrepo
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.423score
python-performance-optimization
eroslifestyle
Profile and optimize Python code using cProfile, memory profilers, and performance best practices.
SkillDFreshness: D★ 1Claude Code +9 - 0.285score
python-performance-optimization
N-H-Logistics
Profile and optimize Python code using cProfile, memory profilers, and performance best practices.
SkillCFreshness: CClaude Code +9
More from ollieb89
- 0.409score
tailwind-v4-shadcn
ollieb89
Use when installing, configuring, or extending Tailwind CSS v4 with shadcn/ui — covers Turborepo monorepo shared-package architecture, CSS config format…
SkillDFreshness: DClaude Code +9 - 0.406score
shadcn-ui
ollieb89
Provides complete shadcn/ui component library patterns including installation, configuration, and implementation of accessible React components.
SkillDFreshness: DClaude Code +9 - 0.403score
route_directive
ollieb89
Analyzes incoming directives and intelligently routes them to appropriate domain PMs, generic L3 execution, or escalation.
SkillDFreshness: DClaude Code +9 - 0.403score
swarm_query
ollieb89
Read-only cross-project state aggregation for L1 visibility.
SkillDFreshness: DClaude Code +9 - 0.403score
coordinate_parallel
ollieb89
Coordinates execution across multiple domain PMs for cross-domain directives.
SkillDFreshness: DClaude Code +9 - 0.385score
finishing-a-development-branch
ollieb89
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting…
SkillDFreshness: DClaude Code +9
Cite this page
python-performance-optimization skill. Agent Mart. https://agentmart.dev/skills/ollieb89-python-performance-optimization (last updated 2026-10-24)