Cpu Profiling

作者 aj-geddes3f5182cfd739無授權條款355 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫7 個月前更新

Profile CPU usage to identify hot spots and bottlenecks. Optimize code paths consuming most CPU time for better performance and resource efficiency.

AI 產生的概覽

指導進行 CPU 效能分析,找出熱點與瓶頸,並最佳化最耗 CPU 的程式碼路徑。

功能
此技能提供 CPU 使用情況分析的指引,用來辨識消耗最多 CPU 時間的函式與程式碼路徑。內容涵蓋瀏覽器與 React 分析流程、分析結果的解讀、最佳化流程,以及監控最佳實務。它產出的是指引與參考資料,而非指令碼或產生的檔案。
適用情境
當應用程式出現 CPU 使用率過高、執行緩慢或效能退步時使用,也適合在進行最佳化工作之前使用。它同時適用於 CPU 行為的正式環境監控。
執行需求
未隨附指令碼,此技能僅為說明與參考文件。它假定可使用效能分析工具,例如瀏覽器開發者工具或 React Profiler。

CPU Profiling

Table of Contents

Overview

CPU profiling identifies which functions consume most CPU time, enabling targeted optimization of expensive code paths.

When to Use

  • High CPU usage
  • Slow execution
  • Performance regression
  • Before optimization
  • Production monitoring

Quick Start

Minimal working example:

yaml
Browser Profiling:
Chrome DevTools:  Steps:    1. DevTools → Performance    2. Click record    3. Perform action    4. Stop recording    5. Analyze flame chart  Metrics:    - Function call duration    - Call frequency    - Total time vs self time
Firefox Profiler:  - Built-in performance profiler  - Flame graphs  - Timeline view  - Export and share
React Profiler:  - DevTools → Profiler  - Component render times  - Phase: render vs commit  - Why component re-rendered// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Profiling Tools [blocked]Profiling Tools
Analysis & Interpretation [blocked]Analysis & Interpretation
Optimization Process [blocked]Optimization Process
Monitoring & Best Practices [blocked]Monitoring & Best Practices

Best Practices

✅ DO

  • Follow established patterns and conventions
  • Write clean, maintainable code
  • Add appropriate documentation
  • Test thoroughly before deploying

❌ DON'T

  • Skip testing or validation
  • Ignore error handling
  • Hard-code configuration values

來源與署名

來源:aj-geddes/useful-ai-prompts位於skills/cpu-profiling提交3f5182c

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架