profile
指定したコードの実行速度をプロファイリングし、ボトルネックを特定する
Installation
Suivez les instructions du dépôt pour votre agent. Consultez les fichiers et dépendances avant l’installation.
Voir la source ↗GuidesInstructions
Profile Code
This skill helps find performance bottlenecks in the code.
Instructions
-
Identify Target:
- Ask user for the script or function call to profile.
-
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
@profiledecorator and runningkernprof -l -v <script_name.py>(requiresline_profilerinstalled).
-
Simple Timer: For quick checks, wrap code in
-
Analyze Output:
- Look for functions with high
cumtime(cumulative time). - Look for functions with high call counts (
ncalls).
- Look for functions with high
-
Report:
- Summarize which parts of the code are consuming the most time.
- Suggest potential optimizations (vectorization, caching, algorithm change).
Exemples
Consultez les exemples du dépôt source.
Voir la source ↗Historique source
- Date d’indexation
- 2026-01-20
- Mise à jour de l’index
- 2026-01-26
- Branch
- main
Les dates concernent ce répertoire. Consultez le dépôt pour l’historique du code.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!