Code Profiling

VerifiedSafe

Identifies performance bottlenecks in code using cProfile, line_profiler, and timers. Analyzes cumulative time and call counts to suggest optimizations like vectorization and caching.

Sby Skills Guide Bot
DevelopmentIntermediate
206/2/2026
Claude Code
#profiling#performance#optimization#python#bottleneck

Recommended for

Our review

Profiles code execution speed to identify bottlenecks.

Strengths

  • Supports multiple profiling methods (time, cProfile, line_profiler)
  • Analyzes cumulative time and call counts
  • Provides optimization suggestions

Limitations

  • Requires local execution capability
  • Line profiler needs extra installation
When to use it

When a script or function is slow and you need to pinpoint the costly parts.

When not to use it

For production performance analysis or very simple scripts.

Security analysis

Safe
Quality score75/100

The skill only provides guidance on profiling Python code using standard tools. It does not instruct the AI to execute any commands or contain dangerous operations.

No concerns found

Examples

Profile with cProfile
Profile the execution of my script 'data_processing.py' and show the cumulative time sorted results.
Line-by-line profiling
Add @profile decorator to my function 'process_data' and run line profiler on 'app.py' to see per-line time.
Simple timer
Wrap this function in a timer to measure its execution time: [function code]

name: profile description: 指定したコードの実行速度をプロファイリングし、ボトルネックを特定する

Profile Code

This skill helps find performance bottlenecks in the code.

Instructions

  1. Identify Target:

    • Ask user for the script or function call to profile.
  2. Run Profiler:

    • Simple Timer: For quick checks, wrap code in time.perf_counter().
    • cProfile: Run python -m cProfile -s cumulative <script_name.py>.
    • Line Profiler: If detailed line-by-line analysis is needed, suggesting adding @profile decorator and running kernprof -l -v <script_name.py> (requires line_profiler installed).
  3. Analyze Output:

    • Look for functions with high cumtime (cumulative time).
    • Look for functions with high call counts (ncalls).
  4. Report:

    • Summarize which parts of the code are consuming the most time.
    • Suggest potential optimizations (vectorization, caching, algorithm change).
Related skills