pyperformance - Python Benchmark Suite
raw JSON → 1.14.0 verified Fri May 01 auth: no python
The official Python benchmark suite for CPython. Provides a collection of benchmarks used to measure and compare performance of Python versions and implementations. Current version is 1.14.0, with regular releases as CPython evolves. Requires Python >=3.10.
pip install pyperformance Common errors
error ModuleNotFoundError: No module named 'pyperformance' ↓
cause pyperformance is not a Python module that can be imported; it's a CLI tool.
fix
Do not import pyperformance. Use
python -m pyperformance or run the pyperformance command directly. error usage: pyperformance [-h] {run,list,show,compile} ... pyperformance: error: unrecognized arguments: --bench=... ↓
cause Using an incorrect CLI syntax, e.g. `--bench=name` instead of `--bench name` or `--benchmarks name`.
fix
Use
--bench or --benchmarks with a space: pyperformance run --bench crypto_pyaes. error ValueError: The number of loops must be at least 1 ↓
cause Running with `--loops=0` or a negative value; pyperformance internally requires at least 1 loop.
fix
Provide a positive integer to
--loops (e.g., --loops=5) or omit the flag to let pyperformance decide. Warnings
gotcha pyperformance is a CLI tool, not a library with importable modules. There is no `import pyperformance` for programmatic use; always invoke via subprocess or shell. ↓
fix Use `subprocess.run(['python', '-m', 'pyperformance', 'run'])` or run the `pyperformance` command directly from the terminal.
gotcha Benchmark results are sensitive to machine state. Running with insufficient warmup or background processes can produce unreliable data. ↓
fix Close all other applications, disable CPU scaling, and use `--strict` for reproducible results.
deprecated Python 3.9 and earlier are no longer supported. Running on older Python may fail or produce errors. ↓
fix Upgrade to Python 3.10 or newer.
Quickstart
import subprocess
import sys
# Run all benchmarks once
subprocess.run([sys.executable, '-m', 'pyperformance', 'run'], check=True)
# Run a specific benchmark
subprocess.run([sys.executable, '-m', 'pyperformance', 'run', '--bench', 'crypto_pyaes'], check=True)