Performance
Local measurements of the Python API using the scripts in benchmarks/.
Results
| Measurement | Coverage |
|---|---|
| 1-D arrays | 11 reducers and their NaN-aware forms, lengths 30–10 million, float32/float64. |
| Axis reductions | Five layouts, including shallow stacks and contiguous last-axis reductions. |
| Sigma clipping | Mask, diagnostic, and fused outputs for vectors and axis-0 stacks. |
Performance depends on operation, dtype, layout, and thread settings. NumPy and Bottleneck can win individual cases; the tables retain those results. Implementation details are in How It Gets Fast.
How To Read The Numbers
Benchmark ratios are reported as np/rd and bn/rd; values above 1 mean reducers is faster.
The 1-D and axis scripts check reducers against NumPy before timing (rtol=1e-12, atol=1e-10 for float64; rtol=1e-6, atol=1e-5 for float32; matching NaNs accepted). A reducers mismatch stops the run. Bottleneck is optional: results that fail the same check are excluded and labelled n/a. Missing implementations use -. Sigma-clipping checks are described on its own page.
These are local timings, not a guarantee across machines or a controlled comparison against an earlier release. Rerun on the target machine when a small difference matters.
Recorded Environment
Recorded 2026-09-08 from eb27fc0: v0.4.0 plus the subsequent overflow fix, built with maturin develop --release --locked --offline. The package version still reports 0.4.0; these are current-checkout results, not measurements of the published v0.4.0 wheel.
| Setting | Value |
|---|---|
| Machine | Apple M4 Pro, macOS 26.6, arm64 |
| Python / NumPy / Bottleneck | 3.13.11 / 2.4.6 / 1.6.0 |
| Rayon / other thread pools | 14 / 1 |
| Grain settings | Built-in defaults; saved tuning disabled |
| Scan / weighted grains | 262144 |
| Median / percentile grains | 1024 |
| 1-D min/max grain | 65536 |
The previous tables used v0.3.2 and tuned variance/minmax grains. Differences between those tables and these runs cannot be attributed solely to the code. Full output linked from each benchmark page records the commit, extension SHA-256, command, resolved grains, and dependency versions.
Set up a project .venv with the benchmark dependencies and a release build:
uv sync --extra dev --extra bench
uv run --no-sync maturin develop --release --lockedUse these settings for the commands on each benchmark page:
export REDUCERS_IGNORE_TUNED_GRAINS=1 RAYON_NUM_THREADS=14
export OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1 VECLIB_MAXIMUM_THREADS=1
export REDUCERS_BENCH_BUILD_COMMIT=$(git rev-parse HEAD)Run benchmarks sequentially on an otherwise idle machine. Clear any REDUCERS_*_GRAIN overrides to reproduce built-in defaults. Set the commit label only after building that checkout; it is caller-supplied metadata.