py-perf

Installation
SKILL.md

Python 效能優化

Quick Start(30 秒上手)

from cProfile import Profile
from pstats import SortKey, Stats

def slow_func() -> list[int]:
    """找出 100 萬以內的質數"""
    return [n for n in range(2, 1_000_000)
            if all(n % d != 0 for d in range(2, int(n**0.5) + 1))]

with Profile() as pr:
    result = slow_func()
    Stats(pr).strip_dirs().sort_stats(SortKey.CUMULATIVE).print_stats(10)
Installs
1
GitHub Stars
1
First Seen
May 8, 2026
py-perf — stevenke1981/python_skills