skillfed

pyperf

Python module to run and analyze benchmarks

pyperf v2.10.0 646.0K downloads/30d#5,597 on PyPI950
Permissive license MIT Active released

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 on this page — 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

pyperf on PyPI

pip

pip install pyperf

uv

uv add pyperf

poetry

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 the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 1 — psutil
Maintenance actively maintained — 188 days since the last release
Last repo commit
First released
Downloads 646,012/month — #5,597 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pyperf-2.10.0-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: Software Development :: Libraries :: Python Modules

Tags

python benchmark runnerperformance testing frameworkstatistical benchmark analysistimeit automationbenchmark comparison toolpython profiling toolkitreliable performance measurement
benchmarkingperformance-testingstatistics

More Python Modules packages