Skip to content
Back to skills

Python Performance

ASecurity

'Consult this skill for Python performance profiling and optimization.

  • 4 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 10, 2026
code-qualitypythongodebuggingdatabaseperformance

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned September 10, 2026

npx -y skills add micsapp/micstec-skills --skill python-performance --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Python Performance?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Python Performance
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/micsapp-python-performance/badge)](https://www.skillsdirectory.com/skills/micsapp-python-performance)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: python-performance
description: 'Consult this skill for Python performance profiling and optimization.
  Use when debugging slow code, identifying bottlenecks, optimizing memory, benchmarking
  performance, production profiling. Do not use when async concurrency - use python-async
  instead. DO NOT use when: CPU/GPU system monitoring - use conservation:cpu-gpu-performance.'
category: performance
tags:
- python
- performance
- profiling
- optimization
- cProfile
- memory
tools:
- profiler-runner
- memory-analyzer
- benchmark-suite
usage_patterns:
- performance-analysis
- bottleneck-identification
- memory-optimization
- algorithm-optimization
complexity: intermediate
estimated_tokens: 1200
progressive_loading: true
modules:
- profiling-tools
- optimization-patterns
- memory-management
- benchmarking-tools
- best-practices
---

# Python Performance Optimization

Profiling and optimization patterns for Python code.

## Table of Contents

1. [Quick Start](#quick-start)

## Quick Start

```python
# Basic timing
import timeit
time = timeit.timeit("sum(range(1000000))", number=100)
print(f"Average: {time/100:.6f}s")
```
**Verification:** Run the command with `--help` flag to verify availability.

## When To Use

- Identifying performance bottlenecks
- Reducing application latency
- Optimizing CPU-intensive operations
- Reducing memory consumption
- Profiling production applications
- Improving database query performance

## When NOT To Use

- Async concurrency - use python-async
  instead
- CPU/GPU system monitoring - use conservation:cpu-gpu-performance
- Async concurrency - use python-async
  instead
- CPU/GPU system monitoring - use conservation:cpu-gpu-performance

## Modules

This skill is organized into focused modules for progressive loading:

### [profiling-tools](modules/profiling-tools.md)
CPU profiling with cProfile, line profiling, memory profiling, and production profiling with py-spy. Essential for identifying where your code spends time and memory.

### [optimization-patterns](modules/optimization-patterns.md)
Ten proven optimization patterns including list comprehensions, generators, caching, string concatenation, data structures, NumPy, multiprocessing, and database operations.

### [memory-management](modules/memory-management.md)
Memory optimization techniques including leak tracking with tracemalloc and weak references for caches. Depends on profiling-tools.

### [benchmarking-tools](modules/benchmarking-tools.md)
Benchmarking tools including custom decorators and pytest-benchmark for verifying performance improvements.

### [best-practices](modules/best-practices.md)
Best practices, common pitfalls, and exit criteria for performance optimization work. Synthesizes guidance from profiling-tools and optimization-patterns.

## Exit Criteria

- Profiled code to identify bottlenecks
- Applied appropriate optimization patterns
- Verified improvements with benchmarks
- Memory usage acceptable
- No performance regressions
## Troubleshooting

### Common Issues

**Command not found**
Ensure all dependencies are installed and in PATH

**Permission errors**
Check file permissions and run with appropriate privileges

**Unexpected behavior**
Enable verbose logging with `--verbose` flag

Files in this skill

  • SKILL.md3.2 KB
  • modules/benchmarking-tools.md1 KB
  • modules/best-practices.md1.2 KB
  • modules/memory-management.md1021 B
  • modules/optimization-patterns.md3.5 KB
  • modules/profiling-tools.md1.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.