mcpField
C
code-profiler

code-profiler

github.com/dkyazzentwatwaDevelopment12456 installsUpdated 29w ago
Repository

About code-profiler

code-profiler is a skill for analyzing Python performance and locating bottlenecks. It measures execution time and memory use, with line-level analysis, call statistics, flamegraphs, and before-and-after comparisons.

Key features

  1. 01Function execution-time profiling
  2. 02Line-by-line analysis
  3. 03Call counts and cumulative time
  4. 04Memory allocation tracking
  5. 05Flamegraph visualization
  6. 06Before-and-after comparison

Use cases

  1. 01Finding slow functions in a Python script
  2. 02Inspecting memory usage
  3. 03Visualizing function call paths
  4. 04Checking an optimization's effect

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/dkyazzentwatwa/chatgpt-skills --skill code-profiler

After installing, type/code-profilerin Claude Code to confirm it loaded.

Bundled filesscripts/code_profiler.pyscripts/requirements.txt

Details

From the project README

Code Profiler

Analyze Python code performance, identify bottlenecks, and optimize execution with comprehensive profiling tools.

Purpose

Performance analysis for:

  • Bottleneck identification
  • Function execution time measurement
  • Memory usage profiling
  • Call graph visualization
  • Optimization validation

Features

  • Time Profiling: Measure function execution times
  • Line-by-Line Analysis: Profile each line of code
  • Call Statistics: Function call counts and cumulative time
  • Memory Profiling: Track memory allocation and usage
  • Flamegraph Visualization: Visual call stack analysis
  • Comparison: Before/after optimization comparison

Quick Start

from code_profiler import CodeProfiler

# Profile function
profiler = CodeProfiler()
profiler.profile_function(my_function, args=(arg1, arg2))
profiler.print_stats(top=10)

# Profile script
profiler.profile_script('script.py')
profiler.export_report('profile_report.html')

CLI Usage

# Profile Python script
python code_profiler.py script.py

# Profile with line-by-line analysis
python code_profiler.py script.py --line-by-line

# Export HTML report
python code_profiler.py script.py --output report.html

Comments

Markdown supported