BenchCore¶
BenchCore is a strongly typed, framework-agnostic benchmarking engine for Python 3.12 and newer.
It measures synchronous Python callables without becoming a test runner. Standalone programs, pytest, and unittest all use the same engine while their framework-specific lifecycle remains isolated.
Why BenchCore?¶
- Strictly typed public APIs compatible with Pyright.
- No runtime dependencies.
- Automatic bounded calibration or explicit iteration counts.
- Warmup, rounds, lifecycle hooks, and injectable timers.
- Immutable results with unit-explicit descriptive statistics.
- Versioned JSON reports, atomic storage, and regression comparison.
- Optional pytest and standard-library unittest integrations.
Smallest example¶
from benchcore import benchmark
result = benchmark(sorted, [5, 4, 3, 2, 1])
print(result.value)
print(result.statistics.mean_ns)
BenchCore is not a replacement for pytest or unittest. Continue with Getting started or review the API reference.