--- id: pyperf version: "2.10.0" license: MIT license_treatment: permissive maintenance: active --- # pyperf — Python module to run and analyze benchmarks License: permissive · Maintenance: active · Downloads: 646.0K/mo ## What it is and what it does pyperf is a Python benchmarking toolkit that automates the process of writing, executing, and analyzing performance tests. It handles the tedious parts of reliable benchmarking—automatic calibration to a time budget, spawning multiple worker processes to reduce noise, computing statistics (mean, standard deviation, percentiles), and detecting unstable results—so you can focus on the code you want to measure. Results are stored in JSON format for later analysis or comparison. You can use it two ways: as a command-line tool (pyperf timeit) for quick one-off measurements, or by writing a benchmark script that instantiates a Runner and calls timeit() or other measurement methods. The toolkit also provides commands to analyze results (pyperf stats), compare benchmark suites across Python versions (pyperf compare_to), and tune your system for stable benchmarking (pyperf system tune). It depends only on psutil for system introspection. Use it for: - Measure the performance of a code snippet or function across multiple runs and detect statistical significance. - Compare benchmark results across different Python versions or implementations to identify regressions. - Track memory usage alongside execution time using --track-memory or --tracemalloc options. - Automate performance testing in CI/CD pipelines by writing benchmark scripts that output JSON results. - Analyze historical benchmark data to spot trends or anomalies in performance over time. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. pyperf is a toolkit for writing, running, and analyzing Python benchmarks with automatic calibration, statistical analysis, and JSON result storage. Yes. pyperf is a mature, actively maintained toolkit (950 stars, recent commits, MIT license) with low install friction. It solves a real problem—reliable Python benchmarking with statistical rigor—that most developers either skip or implement poorly. Install it if you need to measure performance seriously rather than relying on ad-hoc timeit calls. ## Install pip install pyperf uv add pyperf poetry add pyperf ## Installing pyperf Before you install: Low install friction with a single runtime dependency (psutil). Active maintenance with a recent commit on 2026-08-05 and 950 GitHub stars; last release was 2026-02-07, indicating steady upkeep. License in practice: MIT license (permissive) means you can use, modify, and distribute pyperf with minimal restrictions in both open-source and commercial projects. Quickstart: pip install pyperf import pyperf runner = pyperf.Runner() runner.timeit(name="sort a sorted list", stmt="sorted(s, key=f)", setup="f = lambda x: x; s = list(range(1000))") Requires Python 3.9 or newer. Verify before relying: - Whether the package's memory tracking (--track-memory, --tracemalloc) works reliably across different Python versions and platforms. - Performance overhead of pyperf's own measurement infrastructure relative to raw timeit. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 646.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags python benchmark runner, performance testing framework, statistical benchmark analysis, timeit automation, benchmark comparison tool, python profiling toolkit, reliable performance measurement, benchmarking, performance-testing, statistics [View on SkillFed](https://skillfed.io/packages/pyperf) · [View on PyPI](https://pypi.org/project/pyperf/)