Skills DirectoryGitHub에서 엄선한 오픈소스 Skills

python-performance-optimizationcommit 0f73766SKILL.md · 성능 최적화

Python 성능 최적화

cProfile, 메모리 프로파일러 등으로 Python 코드를 프로파일링하고 정리된 패턴으로 병목을 최적화합니다.

npx skills add wshobson/agents --skill python-performance-optimization
권한
  • read-repo
  • write-files
  • shell
  • network
호환 도구
Claude Code, Codex, Cursor, Copilot, OpenCode
GitHub
42.1k
출처
커뮤니티 · Seth Hobson
상태
스캔 통과
라이선스
MIT
카테고리
성능 최적화

핵심 규칙

최적화하기 전에 프로파일링으로 실제 병목을 찾습니다.

실행 단계

  1. 01단계실행 시간 측정

    time으로 대략 측정하고 timeit으로 더 정확하고 반복 가능한 실행 시간을 얻습니다.

  2. 02단계프로파일링

    CPU는 cProfile, 줄 단위는 line_profiler, 메모리는 memory_profiler, 실행 중인 운영 프로세스는 py-spy로 분석합니다.

  3. 03단계핫 패스 최적화

    자주 실행되는 코드에 집중해 dict/set 조회, 컴프리헨션, 제너레이터, 내장 함수, lru_cache, I/O 일괄 처리를 적용합니다.

  4. 04단계고급 기법

    수치 연산에는 NumPy, CPU 바운드에는 멀티프로세싱, I/O 바운드에는 비동기 I/O를 쓰고 DB 작업 일괄 처리와 쿼리 최적화를 합니다.

권한 설명 (SKILL.md 기준)

기능필요 여부설명
파일 쓰기필요최적화 패턴을 적용하려고 Python 코드를 수정합니다.
명령 실행필요timeit, cProfile, kernprof, memory_profiler, py-spy 같은 분석 도구를 실행합니다.
네트워크 송신필요 없음네트워크 접근은 요구하지 않지만, 일부 분석 도구는 미리 pip로 설치해야 할 수 있습니다.

SKILL.md 프런트매터(YAML)

SKILL.md 프런트매터(YAML)commit 0f73766
---
name: python-performance-optimization
description: Profile and optimize Python code using cProfile, memory profilers, and performance best practices. Use when debugging slow Python code, optimizing bottlenecks, or improving application performance.
---

관련 스킬

규칙 스캔으로 모든 위험을 찾을 수는 없습니다. 설치 전에 이 스킬의 SKILL.md를 읽고 권한을 확인하세요.