mcpField
P
python-performance

python-performance

github.com/atholaDevelopment343116 installsUpdated 1d ago
Repository

About python-performance

A Python performance optimization skill for developers who need to find bottlenecks and verify improvements through profiling and benchmarks.

Key features

  1. 01CPU and memory profiling
  2. 02Optimization patterns for Python code
  3. 03Memory leak tracking
  4. 04Benchmarking with custom decorators and pytest-benchmark
  5. 05Performance best practices and exit criteria

Use cases

  1. 01Finding CPU or memory bottlenecks
  2. 02Reducing application latency or memory use
  3. 03Checking whether an optimization improves performance

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/athola/claude-night-market --skill python-performance

After installing, type/python-performancein Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

modules/
benchmarking-tools.md
best-practices.md
memory-management.md
optimization-patterns.md
profiling-tools.md

Details

From the project README

Python Performance Optimization

Profiling and optimization patterns for Python code.

Quick Start

# 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

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

Eleven proven optimization patterns including list comprehensions, generators, caching, string concatenation, data structures, NumPy, multiprocessing, database operations, and loop transformations (what works in Python vs the compiler).

memory-management

Memory optimization techniques including leak tracking with tracemalloc and weak references for caches. Depends on profiling-tools.

benchmarking-tools

Benchmarking tools including custom decorators and pytest-benchmark for verifying performance improvements.

best-practices

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

Comments

Markdown supported