python-profiling
CommunityMake Python faster with measurement-first profiling.
Software Engineering#python#performance optimization#profiling#bottleneck analysis#memory usage#pytest-benchmark#benchmark validation
Authorfgmacedo
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Speed issues and memory bloat in Python code are hard to fix without knowing where time and allocations are actually going, so this Skill provides a structured, benchmark-driven way to identify bottlenecks and validate improvements.
Core Features & Use Cases
- CPU and memory profiling workflow: Choose the right tool for CPU-bound vs memory-bound problems and move from broad to precise diagnostics.
- Benchmark-first optimization: Establish a baseline with pytest-benchmark (or ad-hoc cProfile) and require measurable before/after improvement after each single change.
- Tool-driven investigation: Use cProfile for overview, line_profiler for per-line CPU hotspots, py-spy for low-intrusion sampling, tracemalloc for allocation tracking, and memray/scalene for deeper memory insights.
- Use case example: When a service endpoint is “slow,” run a baseline benchmark, identify the hottest call paths, apply one optimization (e.g., reduce allocations or cache repeated work), then rerun benchmarks and the full test suite to ensure correctness.
Quick Start
Ask the agent to profile the Python code and reduce memory usage by running a baseline, identifying the bottleneck with the appropriate profiler(s), applying one optimization at a time, and validating the results with benchmarks and the full test suite.
Dependency Matrix
Required Modules
None requiredComponents
references
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: python-profiling Download link: https://github.com/fgmacedo/agent-skills/archive/main.zip#python-profiling Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.