Skip to content
Development
Command

/run-profiler

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

From plugin
claude-night-market
325163 skills59 agents163 commands1 MCP
Install
$ npx -y skills add athola/claude-night-market --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/run-profiler

Context preview

What this command does when you run it.

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

Command definition

run-profiler.md

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
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.

Get the whole plugin, auto-invoked
Stats
325
Stars
0
Views
35
Forks
Active
Maintenance
Python
Language
MIT
License
1d ago
Last commit
8mo ago
Created

Repo: athola/claude-night-market