Skip to content
Development
Command

/run-profiler

Profile Python code for performance bottlenecks using cProfile, memory_profiler, or py-spy.

From plugin
claude-night-market
343162 skills60 agents162 commands1 MCP
> /plugin marketplace add athola/claude-night-market

Command definition

run-profiler.md
name: run-profiler
description: Profile Python code for performance bottlenecks using cProfile, memory_profiler, or py-spy.

Run Profiler Command

Usage

Profiles Python code for performance bottlenecks using cProfile, memory_profiler, or py-spy.

Basic Usage

/run-profiler script.py

Runs CPU profiling on the specified script.

With Options

/run-profiler --memory script.py
/run-profiler --line function_name script.py

What It Does

1. **CPU Profiling**: Identifies time-consuming functions 2. **Memory Profiling**: Tracks memory allocations and leaks 3. **Line Profiling**: Profile specific functions line-by-line 4. **Flamegraph Generation**: Visual representation of call stacks 5. **Recommendations**: Suggests optimization patterns

Profiling Modes

CPU Mode (default)

/run-profiler script.py

Uses cProfile to identify slow functions.

Memory Mode

/run-profiler --memory script.py

Uses memory_profiler to track allocations.

Line Mode

/run-profiler --line expensive_function script.py

Uses line_profiler for detailed analysis.

Production Mode

/run-profiler --pid 12345

Uses py-spy for profiling running processes.

Output Format

  • **Top Functions**: Ranked by cumulative time
  • **Memory Usage**: Peak and average consumption
  • **Hotspots**: Specific lines causing issues
  • **Recommendations**: Optimization suggestions

Examples

# Profile with top 20 functions
/run-profiler --top 20 main.py

# Generate flamegraph
/run-profiler --flamegraph output.svg main.py

# Memory profile with threshold
/run-profiler --memory --threshold 100MB main.py

Integration

Uses the `python-performance` skill's profiling tools:

  • `profiler-runner`: cProfile and py-spy execution
  • `memory-analyzer`: Memory usage analysis
  • `benchmark-suite`: Comparative benchmarking

This command helps identify and resolve performance bottlenecks efficiently.

Read more
@athola
Ships withclaude-night-market

A plugin marketplace for Claude Code. Install only the plugins you need to run git workflows, code review, spec-driven development, and autonomous agents from inside your Claude Code session.

343200 skills60 agents1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
343
Star history of athola/claude-night-market on GitHub, a chart by star-history.com

Other commands on claude-night-market.

More commands from other plugins.

build
Auto-invoked

build

Command

Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.

@addyosmani@addyosmaniInstall Command