phit

phit

Benchmarks

Timings from the benchmark files in the phit repository. Each report gives the machine and date it was recorded, so an older report may not reflect the current code.

OLS: fit time

Median wall time to fit ols models on the same simulated data in R, Python and phit. Data loading is timed separately and excluded.

Apple M5 Ultra · macOS-27.0.1-arm64-arm-64bit-Mach-O · PHP 8.5.10 · 5 repeats · recorded 2026-10-16

Case R statsmodels phit
n = 1,000, p = 3 not measured1 0.212 0.130
n = 100,000, p = 3 15.0 4.94 10.6
n = 1,000,000, p = 3 183 90.1 113
n = 100,000, p = 11 20.0 11.2 27.4

Median fit wall time, in ms. Values without a measurement are left out of the chart.

1 Below the 1 ms resolution of R's timer.

Logistic regression: fit time

Median wall time to fit logistic regression models on the same simulated data in R, Python and phit. Data loading is timed separately and excluded.

Apple M5 Ultra · macOS-27.0.1-arm64-arm-64bit-Mach-O · PHP 8.5.10 · 5 repeats · recorded 2026-10-16

Case R statsmodels phit
n = 1,000, p = 3 1.00 0.561 0.345
n = 100,000, p = 3 70.0 21.2 37.2
n = 1,000,000, p = 3 804 240 405
n = 100,000, p = 11 121 27.0 79.4

Median fit wall time, in ms. Values without a measurement are left out of the chart.

Probit regression: fit time

Median wall time to fit probit regression models on the same simulated data in R, Python and phit. Data loading is timed separately and excluded.

Apple M5 Ultra · macOS-27.0.1-arm64-arm-64bit-Mach-O · PHP 8.5.10 · 5 repeats · recorded 2026-10-16

Case R statsmodels phit
n = 1,000, p = 3 2.00 1.88 1.43
n = 100,000, p = 3 156 59.2 138
n = 1,000,000, p = 3 1,192 591 1,232
n = 100,000, p = 11 210 89.8 196

Median fit wall time, in ms. Values without a measurement are left out of the chart.

Poisson regression: fit time

Median wall time to fit poisson regression models on the same simulated data in R, Python and phit. Data loading is timed separately and excluded.

Apple M5 Ultra · macOS-27.0.1-arm64-arm-64bit-Mach-O · PHP 8.5.10 · 5 repeats · recorded 2026-10-16

Case R statsmodels phit
n = 1,000, p = 3 2.00 0.767 0.245
n = 100,000, p = 3 135 31.1 26.2
n = 1,000,000, p = 3 1,437 329 278
n = 100,000, p = 11 283 68.4 69.5

Median fit wall time, in ms. Values without a measurement are left out of the chart.

Gaussian random intercept: fit time

Median wall time to fit gaussian random intercept models on the same simulated data in R, Python and phit. Data loading is timed separately and excluded.

Apple M5 Ultra · macOS-27.0.1-arm64-arm-64bit-Mach-O · PHP 8.5.10 · 5 repeats · recorded 2026-10-11

Case R statsmodels phit
n = 1,000, p = 3 6.00 13.8 0.289
n = 100,000, p = 3 229 129 13.1
n = 1,000,000, p = 3 2,541 1,734 138
n = 100,000, p = 11 406 244 34.3

Median fit wall time, in ms. Values without a measurement are left out of the chart.

Binomial random intercept: fit time

Median wall time to fit binomial random intercept models on the same simulated data in R, Python and phit. Data loading is timed separately and excluded.

Apple M5 Ultra · macOS-27.0.1-arm64-arm-64bit-Mach-O · PHP 8.5.10 · 3 repeats · recorded 2026-10-11

Case R SciPy phit
n = 1,000, p = 3 88.0 410 6.29
n = 10,000, p = 3 554 664 68.2
n = 100,000, p = 3 7,698 2,765 786

Median fit wall time, in ms. Values without a measurement are left out of the chart.

Distributions: evaluation time

Median wall time to evaluate a distribution function over a batch of inputs in phit (scalar calls and one batch call), the Rust core, R and SciPy.

Apple M5 Ultra · macOS-27.0.1-arm64-arm-64bit-Mach-O · PHP 8.5.10 · 5 repeats · recorded 2026-10-12

Case phit (scalar) phit (batch) Rust core R SciPy
normal_cdf, n = 1,000 0.041 0.022 0.011 0.020 0.019
normal_cdf, n = 100,000 4.09 2.23 1.37 2.00 1.23
normal_cdf, n = 1,000,000 41.3 23.6 14.3 17.0 12.1
normal_sf, n = 1,000 0.044 0.021 0.012 0.020 0.019
normal_sf, n = 100,000 4.41 2.15 1.24 2.00 0.989
normal_sf, n = 1,000,000 44.1 21.0 14.5 16.0 9.90
t_quantile, n = 1,000 0.598 0.578 0.575 0.230 0.140
t_quantile, n = 100,000 59.8 57.9 56.8 23.0 12.5
t_quantile, n = 1,000,000 602 580 570 222 122
binomial_logpmf, n = 1,000 0.071 0.033 0.022 0.030 0.039
binomial_logpmf, n = 100,000 6.82 3.47 2.65 3.00 2.49
binomial_logpmf, n = 1,000,000 66.1 35.0 26.7 31.0 24.8
poisson_logpmf, n = 1,000 0.041 0.021 0.009 0.030 0.020
poisson_logpmf, n = 100,000 4.11 2.31 1.26 3.00 1.36
poisson_logpmf, n = 1,000,000 40.8 22.0 12.9 30.0 14.1
mean, n = 1,000 0.009 0.002 0.002 0.001
mean, n = 100,000 0.875 0.147 0.110 0.011
mean, n = 1,000,000 8.28 1.50 1.10 0.100
variance, n = 1,000 0.010 0.003 0.004 0.003
variance, n = 100,000 1.01 0.274 0.210 0.046
variance, n = 1,000,000 10.2 2.74 2.10 0.445
beta_quantile, n = 1,000 0.942 0.920 0.911 0.390 0.373
beta_quantile, n = 100,000 91.4 89.1 87.8 39.0 35.4
beta_quantile, n = 1,000,000 916 892 881 396 353
chisquare_cdf, n = 1,000 0.067 0.038 0.032 0.030 0.127
chisquare_cdf, n = 100,000 7.33 4.15 3.30 3.00 13.7
chisquare_cdf, n = 1,000,000 72.4 38.7 31.8 33.0 118

Median wall time, in ms. Values without a measurement are left out of the chart.

Posterior draws: moments and transforms

Median wall time for weighted draw moments (population and unbiased), covariance maps and affine transforms in phit and R.

Apple M5 Ultra · macOS-27.0.1-arm64-arm-64bit-Mach-O · PHP 8.5.10 · 5 repeats · recorded 2026-10-12

Case R phit
n = 1,000 draws, p = 4, population 0.037 0.091
n = 1,000 draws, p = 4, unbiased 0.040 0.081
n = 1,000 draws, p = 4, covariance map 0.010 0.001
n = 1,000 draws, p = 4, affine 0.026 0.119
n = 4,000 draws, p = 16, population 0.400 1.42
n = 4,000 draws, p = 16, unbiased 0.400 1.43
n = 4,000 draws, p = 16, covariance map 0.015 0.012
n = 4,000 draws, p = 16, affine 0.260 1.62
n = 10,000 draws, p = 32, population 2.40 8.84
n = 10,000 draws, p = 32, unbiased 2.10 8.67
n = 10,000 draws, p = 32, covariance map 0.026 0.044
n = 10,000 draws, p = 32, affine 1.60 6.85
n = 100,000 draws, p = 8, population 6.00 17.6
n = 100,000 draws, p = 8, unbiased 5.60 18.7
n = 100,000 draws, p = 8, covariance map 0.011 0.004
n = 100,000 draws, p = 8, affine 3.70 21.6

Median wall time, in ms. Values without a measurement are left out of the chart.