{"categories":[{"label":"Utilities","url":"https://skillfed.io/packages/category/utilities"}],"enrichment":{"capability":"A pytest fixture that benchmarks Python functions by running them in calibrated rounds and generating performance reports with timing statistics.","skillfed_tags":["performance-testing","pytest-plugin","profiling"],"use_cases":["Measure and track performance regressions in a CI/CD pipeline by comparing benchmark results across commits.","Profile and optimize hot-path functions by running repeated timed iterations with automatic calibration.","Generate performance reports and histograms to document the speed of critical algorithms or library functions.","Set up parametrized benchmarks to test performance across different input sizes or configurations.","Integrate cProfile or tracing into benchmarks to identify bottlenecks in slow functions."],"what_it_does":"pytest-benchmark is a pytest plugin that turns test functions into performance benchmarks by wrapping code execution in a calibrated timing harness. It groups runs into rounds, automatically adjusting iteration counts to produce stable measurements, and generates comparison reports and histograms. The package integrates directly into pytest's test discovery and reporting, so you write benchmarks as normal test functions that receive a `benchmark` fixture.\n\nThe plugin is designed for function-level micro-benchmarking and provides both simple mode (pass a function and arguments) and pedantic mode with explicit control over setup, iterations, rounds, and per-round teardown. It collects CPU info via py-cpuinfo and supports profiling, tracing, and cProfile integration. Results can be compared across runs and exported to CSV.","worth_installing":"Yes. pytest-benchmark is actively maintained, has no known vulnerabilities, low install friction, and a permissive license. It is the standard tool for pytest-based performance testing and is well-suited for any project that needs to track or optimize function-level performance."},"id":"pytest-benchmark","links":{"html":"https://skillfed.io/packages/pytest-benchmark","md":"https://skillfed.io/packages/pytest-benchmark.md","pypi":"https://pypi.org/project/pytest-benchmark/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2025-11-09","license_spdx":"BSD-2-Clause","license_treatment":"permissive","name":"pytest-benchmark","python_support":"supports_current","summary":"A ``pytest`` fixture for benchmarking code. It will group the tests into rounds that are calibrated to the chosen timer."},"popularity":{"monthly_downloads":14224897,"position":1243,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"5.2.3"}
