profile

Profile Python and Rust code performance to identify CPU and memory bottlenecks.

4|2|Updated Jan 27, 2026
One-click install
npx skills add https://github.com/Arete-Consortium/ai-skills --skill profile-arete-consortium
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: profile
Source: https://github.com/Arete-Consortium/ai-skills/tree/main/personas/devops/profile
Command: npx skills add https://github.com/Arete-Consortium/ai-skills --skill profile-arete-consortium

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Slow code is hard to fix without knowing where time and memory are actually spent. This Skill runs CPU and memory profilers on Python scripts and Rust binaries, then turns raw profiling data into a structured report with hotspots, root-cause analysis, and concrete optimization suggestions. ## Core Features & Use Cases - CPU Profiling: Run cProfile, line_profiler, or py-spy on Python code and perf/flamegraph on Rust binaries to find the hottest functions. - Memory Profiling: Use memory_profiler or heaptrack to detect large allocations and memory-heavy code paths. - Visualization: Generate flame graphs and call trees to make bottlenecks visible at a glance. - Use Case: A data pipeline script takes 5 minutes to run. Profile it, discover that a nested O(n²) loop in process_data consumes 45% of runtime, and get a suggested dict-lookup rewrite with an estimated 10x speedup. ## Quick Start Ask Claude to profile your Python script and report the top functions by time with optimization recommendations.

Frequently Asked Questions about profile

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I profile a Python script for CPU performance?▼

Run python -m cProfile -o profile.stats script.py to capture statistics, then use pstats to sort by cumulative time and print the top functions. For line-level detail, use line_profiler with kernprof -l -v script.py.

How to profile memory usage in Python code?▼

Use memory_profiler by adding the @profile decorator to target functions and running python -m memory_profiler script.py. It reports line-by-line memory consumption so you can find large allocations.

What tools profile Rust binaries for performance?▼

Use cargo flamegraph to generate a flame graph of CPU usage, or perf record --call-graph=dwarf followed by perf report for detailed analysis. For memory profiling, use heaptrack and inspect results with heaptrack_gui.

Can I profile a running Python process without restarting it?▼

Yes, py-spy attaches to a running process by PID: py-spy record -o profile.svg --pid 12345. It samples the stack without modifying or restarting the target program.

Why is my code slow even though no single function dominates?▼

Time may be spread across many small calls, such as repeated JSON parsing or frequent database queries. Check call counts in the profile report and consider caching results or batching queries.