python-performance-optimization
最佳化 Python 效能
缺乏清楚量測時,緩慢的 Python 程式碼很難改善。此技能會引導 Claude、Codex 和 Claude Code 進行效能剖析、基準測試,以及目標明確的最佳化模式。
使用我的智慧代理安裝
將此請求複製給你的智慧代理,其中包含權威 Skill 頁面和清單。
Review the Skillstore skill "python-performance-optimization" from https://skillstore.io/skills/activeinferenceinstitute-python-performance-optimization.md and its manifest at https://skillstore.io/api/skills/activeinferenceinstitute-python-performance-optimization/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.你的智慧代理仍應顯示其計畫,並依安全政策請求必要確認。
Agent 可讀資源
當 AI Agent、爬蟲或腳本需要乾淨脈絡、而不是讀取完整頁面時,請使用這些連結。
測試它
正在使用「python-performance-optimization」。 我的 Python batch job 很慢,而且我不知道該從哪裡開始。
預期結果:
- 從 cProfile 開始,找出累積時間最高的函式。
- 使用 pstats 排序結果,並專注在最主要的熱點路徑。
- 一次只基準測試一項變更,讓每項改善都有量測證據。
正在使用「python-performance-optimization」。 某個檔案處理 script 使用太多記憶體。
預期結果:
- 檢查 script 是否將完整檔案或大型 list 載入記憶體。
- 在可行處,將完整 materialization 替換為 iterator 或 generator。
- 在變更前後使用記憶體剖析,確認尖峰使用量降低。
正在使用「python-performance-optimization」。 我的 API 會等待多個 HTTP call。
預期結果:
- 在加入 multiprocessing 前,先將工作負載分類為 I/O-bound。
- 當 request 可以並行執行時,考慮使用 async I/O。
- 針對安全的測試端點量測延遲與錯誤行為。
安全審計
低風險Most static detections are false positives caused by Markdown code fences and educational Python examples. The only confirmed issue is low-severity guidance for py-spy commands that attach to live processes and may expose stack traces if used without authorization. No prompt injection, credential exfiltration, or malicious intent was found.
已確認的安全問題 (3)
風險因素
⚙️ 外部命令 (49)
偵測到的模式
分享與引用此報告
分享版本化評估報告、中性徽章、嵌入卡片與引用。Skillstore 只報告證據,不判斷該 Skill 是否安全。
複製報告連結
https://skillstore.io/skills/activeinferenceinstitute-python-performance-optimization/audits/10?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown 徽章
[](https://skillstore.io/skills/activeinferenceinstitute-python-performance-optimization?utm_source=security_passport_badge)HTML 徽章
<a href="https://skillstore.io/skills/activeinferenceinstitute-python-performance-optimization?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/activeinferenceinstitute-python-performance-optimization/security.svg" alt="Skillstore security assessment" loading="lazy"></a>嵌入卡片
<iframe src="https://skillstore.io/embed/skills/activeinferenceinstitute-python-performance-optimization.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>學術引用 (APA · BibTeX · CFF)
APA 引用
ActiveInferenceInstitute. (2026). python-performance-optimization security audit report (audit version 10) [Author version unspecified]. Skillstore. https://skillstore.io/skills/activeinferenceinstitute-python-performance-optimization/audits/10BibTeX 引用
@techreport{activeinferenceinstitute-activeinferenceinstitute-python-performance-optimization-2026,
author = {ActiveInferenceInstitute},
title = {python-performance-optimization security audit report (audit version 10)},
institution = {Skillstore},
year = {2026},
number = {10},
url = {https://skillstore.io/skills/activeinferenceinstitute-python-performance-optimization/audits/10},
note = {Author version unspecified}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "python-performance-optimization security audit report (audit version 10)"
version: "unspecified"
type: report
authors:
- name: "ActiveInferenceInstitute"
date-released: "2026-07-09"
url: "https://skillstore.io/skills/activeinferenceinstitute-python-performance-optimization/audits/10"
identifiers:
- type: other
value: "skillstore:activeinferenceinstitute-python-performance-optimization:audit:10"
description: "Skillstore immutable audit report identifier"
比較變體
3 個可安裝變體每位作者的技能都保留為獨立的可安裝項目。推薦變體依 Skillstore 證據排序。
為何此變體排名第一
sickn33-python-performance-optimization
2026-09-09
wshobson-python-performance-optimization
2026-09-09
activeinferenceinstitute-python-performance-optimization
2026-10-21
Skillstore 評分
評分依據 證據置信度: 高你可以打造什麼
診斷緩慢的服務端點
在修改程式碼前,使用效能剖析輸出來找出熱點函式、昂貴的查詢或阻塞的 I/O。
降低資料工作的記憶體壓力
比較以 list 為基礎的處理方式與 generator、iterator、weak reference,以及記憶體剖析技術。
準備效能改善計畫
對目前行為進行基準測試,選擇聚焦的最佳化模式,並在每次變更後量測結果。
試試這些提示
使用 python-performance-optimization 技能來協助我剖析這個 Python 函式。說明應該先使用哪個 profiler,以及什麼結果能證明瓶頸所在。
使用 python-performance-optimization 技能來審查這個緩慢的 Python loop。建議更快的資料結構或內建操作,然後說明如何對變更進行基準測試。
使用 python-performance-optimization 技能來分析這個大量使用記憶體的 Python 工作流程。找出 generator、iterator 或 weak reference 可能降低記憶體使用的位置。
使用 python-performance-optimization 技能,為這個 Python 應用程式建立以量測為導向的最佳化計畫。包含 CPU profiling、memory profiling、I/O review、database checks 和 benchmark validation。
最佳實務
- 先進行效能剖析再最佳化,讓變更針對已量測的瓶頸。
- 讓基準測試保持小型、可重複,並貼近真實工作負載。
- 比較前後結果,包括執行時間、記憶體和正確性。
避免
- 不要最佳化不屬於已量測變慢原因的程式碼路徑。
- 不要假設 microbenchmark 結果適用於每一種 production workload。
- 未經授權,不要將 profiler 附加到 production process。
常見問題
這個技能會自動執行 profiler 嗎?
我應該從哪個 profiler 開始?
它能協助處理 production 效能問題嗎?
它涵蓋資料庫效能嗎?
它能協助處理 network-bound Python 程式碼嗎?
每項最佳化都會改善我的應用程式嗎?
開發者詳細資訊
授權
MIT
Skillstore 修訂
r1
版本提示
作者未聲明版本。
引用
7db9b9f06e0ab79c575b58bc48c4d8dc9849f424
維護新鮮度
2026/7/23
使用量
13 次下載 · 302 次瀏覽
檔案結構
📄 SKILL.md