Home | Libraries | People | FAQ | More |
We've run our performance tests both for our own code, and against other open source implementations of the same functions. The results are presented below to give you a rough idea of how they all compare. In order to give a more-or-less level playing field our test data was screened against all the libraries being tested, and any unsupported domains removed, likewise for any test cases that gave large errors or unexpected non-finite values.
Caution | |
---|---|
You should exercise extreme caution when interpreting these results, relative performance may vary by platform, by compiler options settings, the tests use data that gives good code coverage of our code, but which may skew the results towards the corner cases. Finally, remember that different libraries make different choices with regard to performance verses numerical stability. |
The first results compare standard library functions to Boost equivalents with MSVC-14.0:
Table 22.14. Library Comparison with Microsoft Visual C++ version 14.2 on Windows x64
Function |
boost 1.73 |
math.h |
---|---|---|
cbrt |
1.00 |
1.22 |
cyl_bessel_j (integer order) |
1.00 |
1.50 |
cyl_neumann (integer order) |
1.01 |
1.00 |
erf |
2.15 |
1.00 |
erfc |
1.00 |
1.09 |
expm1 |
1.10 |
1.00 |
lgamma |
1.00 |
1.60 |
log1p |
1.00 |
1.07 |
tgamma |
1.00 |
12.53 |
On Linux with GCC, we can also compare to the TR1 functions, and to GSL and RMath:
Table 22.15. Library Comparison with GNU C++ version 9.2.1 20191008 on linux
Function |
boost 1.73 |
boost 1.73 |
tr1/cmath |
GSL 2.5 |
Rmath 3.6.3 |
math.h |
---|---|---|---|---|---|---|
assoc_laguerre |
1.09 |
1.00 |
1.03 |
1.16 |
- |
- |
assoc_legendre |
7.75 |
4.75 |
1.00 |
3.25 |
- |
- |
beta (incomplete) |
3.96 |
1.00 |
- |
1.20 |
- |
- |
beta |
7.51 |
1.00 |
1.38 |
3.14 |
2.27 |
- |
cbrt |
2.32 |
1.00 |
1.28 |
- |
- |
1.24 |
cyl_bessel_i (integer order) |
4.76 |
1.08 |
1.00 |
1.83 |
5.25 |
- |
cyl_bessel_i |
7.12 |
1.44 |
1.00 |
4.14 |
7.92 |
- |
cyl_bessel_j (integer order) |
2.95 |
1.00 |
2.19 |
1.73 |
3.59 |
1.39 |
cyl_bessel_j |
3.16 |
1.06 |
1.00 |
1.65 |
1.09 |
- |
cyl_bessel_k (integer order) |
18.17 |
1.00 |
9.73 |
1.10 |
1.31 |
- |
cyl_bessel_k |
10.37 |
1.00 |
1.83 |
1.02 |
1.09 |
- |
cyl_neumann (integer order) |
2.71 |
1.00 |
3.95 |
3.03 |
5.05 |
1.31 |
cyl_neumann |
14.08 |
7.68 |
1.21 |
1.26 |
1.00 |
- |
digamma |
1.77 |
1.00 |
- |
2.97 |
6.20 |
- |
ellint_1 (complete) |
1.48 |
1.00 |
1.56 |
3.03 |
- |
- |
ellint_1 |
2.01 |
1.00 |
1.24 |
2.13 |
- |
- |
ellint_2 (complete) |
1.76 |
1.00 |
8.76 |
15.24 |
- |
- |
ellint_2 |
2.98 |
1.00 |
1.25 |
2.15 |
- |
- |
ellint_3 (complete) |
-nan |
-nan |
-nan |
-nan |
- |
- |
ellint_3 |
3.52 |
1.25 |
1.00 |
1.36 |
- |
- |
ellint_rc |
2.13 |
1.00 |
- |
5.03 |
- |
- |
ellint_rd |
3.34 |
1.00 |
- |
1.88 |
- |
- |
ellint_rf |
1.71 |
1.00 |
- |
4.65 |
- |
- |
ellint_rj |
3.04 |
1.00 |
- |
10.84 |
- |
- |
erf |
1.71 |
- |
1.00 |
4.21 |
- |
1.00 |
erfc |
3.18 |
2.32 |
1.00 |
3.32 |
- |
1.00 |
expint (En) |
2.12 |
1.00 |
- |
3.86 |
- |
- |
expint |
2.02 |
1.00 |
2.60 |
4.10 |
- |
- |
expm1 |
1.19 |
1.00 |
1.00 |
- |
- |
1.06 |
gamma_p |
2.64 |
1.11 |
- |
1.79 |
1.00 |
- |
gamma_p_inv |
2.24 |
1.00 |
- |
- |
1.17 |
- |
gamma_q |
2.59 |
1.04 |
- |
2.02 |
1.00 |
- |
gamma_q_inv |
2.57 |
1.22 |
- |
- |
1.00 |
- |
ibeta |
5.33 |
1.41 |
- |
- |
1.00 |
- |
ibeta_inv |
2.92 |
1.00 |
- |
- |
2.73 |
- |
ibetac |
4.44 |
1.31 |
- |
- |
1.00 |
- |
ibetac_inv |
2.99 |
1.00 |
- |
- |
2.43 |
- |
jacobi_cn |
7.00 |
2.36 |
- |
1.00 |
- |
- |
jacobi_dn |
7.19 |
2.47 |
- |
1.00 |
- |
- |
jacobi_sn |
6.20 |
1.82 |
- |
1.00 |
- |
- |
laguerre |
1.02 |
1.00 |
1.10 |
1.49 |
- |
- |
legendre Q |
1.24 |
1.00 |
- |
1.08 |
- |
- |
legendre |
1.12 |
1.00 |
1.16 |
1.31 |
- |
- |
lgamma |
5.30 |
2.34 |
1.04 |
4.08 |
2.08 |
1.00 |
log1p |
1.18 |
1.29 |
1.00 |
- |
- |
1.00 |
polygamma |
23.31 |
1.98 |
- |
1.57 |
1.00 |
- |
sph_bessel |
1.91 |
1.00 |
3.14 |
1.96 |
- |
- |
sph_neumann |
7.16 |
2.56 |
7.44 |
1.00 |
- |
- |
tgamma (incomplete) |
2.90 |
1.00 |
- |
2.19 |
- |
- |
tgamma |
4.10 |
1.25 |
1.33 |
1.03 |
1.00 |
1.57 |
trigamma |
2.08 |
1.00 |
- |
53.75 |
30.92 |
- |
zeta |
4.21 |
1.00 |
1078.95 |
2.03 |
- |
- |
And finally we can compare the statistical distributions to GSL, RMath and DCDFLIB:
Table 22.16. Distribution performance comparison with GNU C++ version 9.2.1 20191008 on linux
Function |
boost 1.73 |
Boost |
GSL |
Rmath 3.6.3 |
DCDFLIB |
---|---|---|---|---|---|
ArcSine (CDF) |
1.06 |
1.00 |
|||
ArcSine (PDF) |
1.00 |
1.00 |
|||
ArcSine (quantile) |
1.04 |
1.00 |
|||
Beta (CDF) |
3.14 |
1.00 |
3.24 |
1.94 |
2.52 |
Beta (PDF) |
3.50 |
1.00 |
- |
2.31 |
|
Beta (quantile) |
2.61 |
1.00 |
14.97 |
1.83 |
7.24 |
Binomial (CDF) |
2.58 |
1.00 |
2.16 |
1.49 |
1.65 |
Binomial (PDF) |
2.66 |
1.00 |
- |
1.83 |
|
Binomial (quantile) |
2.96 |
1.17 |
- |
1.00 |
6.59 |
Cauchy (CDF) |
1.00 |
1.00 |
1.57 |
1.57 |
|
Cauchy (PDF) |
1.00 |
1.00 |
- |
5.67 |
|
Cauchy (quantile) |
1.00 |
1.07 |
75.60 |
1.93 |
|
ChiSquared (CDF) |
6.00 |
3.03 |
9.54 |
1.46 |
1.00 |
ChiSquared (PDF) |
3.43 |
1.00 |
- |
1.28 |
|
ChiSquared (quantile) |
2.04 |
1.00 |
18.96 |
1.84 |
6.40 |
Exponential (CDF) |
1.00 |
1.47 |
1.68 |
1.84 |
|
Exponential (PDF) |
1.00 |
1.17 |
- |
1.57 |
|
Exponential (quantile) |
1.00 |
1.13 |
1.48 |
1.57 |
|
ExtremeValue (CDF) |
1.00 |
1.02 |
|||
ExtremeValue (PDF) |
1.06 |
1.00 |
|||
ExtremeValue (quantile) |
1.04 |
1.00 |
|||
F (CDF) |
2.83 |
1.00 |
2.52 |
1.38 |
1.51 |
F (PDF) |
2.87 |
1.00 |
- |
1.24 |
|
F (quantile) |
2.11 |
1.00 |
11.07 |
2.09 |
5.32 |
Gamma (CDF) |
4.10 |
1.53 |
3.93 |
1.43 |
1.00 |
Gamma (PDF) |
3.87 |
1.00 |
- |
1.35 |
|
Gamma (quantile) |
2.83 |
1.17 |
11.04 |
2.25 |
1.00 |
Geometric (CDF) |
1.00 |
1.08 |
2.12 |
2.32 |
|
Geometric (PDF) |
1.00 |
1.00 |
- |
15.78 |
|
Geometric (quantile) |
1.00 |
1.12 |
- |
2.88 |
|
Hypergeometric (CDF) |
95.49 |
88.59 |
1.00 |
1.04 |
|
Hypergeometric (PDF) |
141.15 |
121.97 |
- |
1.00 |
|
Hypergeometric (quantile) |
1.38 |
1.75 |
- |
1.00 |
|
InverseChiSquared (CDF) |
1.92 |
1.00 |
|||
InverseChiSquared (PDF) |
2.72 |
1.00 |
|||
InverseChiSquared (quantile) |
1.76 |
1.00 |
|||
InverseGamma (CDF) |
2.25 |
1.00 |
|||
InverseGamma (PDF) |
3.41 |
1.00 |
|||
InverseGamma (quantile) |
2.37 |
1.00 |
|||
InverseGaussian (CDF) |
1.00 |
1.03 |
|||
InverseGaussian (PDF) |
1.00 |
1.00 |
|||
InverseGaussian (quantile) |
1.00 |
1.08 |
|||
Laplace (CDF) |
1.00 |
1.02 |
1.20 |
||
Laplace (PDF) |
1.00 |
1.02 |
|||
Laplace (quantile) |
1.00 |
1.03 |
1.08 |
||
LogNormal (CDF) |
2.14 |
1.34 |
1.00 |
1.14 |
|
LogNormal (PDF) |
1.00 |
1.03 |
- |
1.00 |
|
LogNormal (quantile) |
1.35 |
1.29 |
1.00 |
1.03 |
|
Logistic (CDF) |
1.00 |
1.00 |
1.73 |
1.15 |
|
Logistic (PDF) |
1.00 |
1.00 |
- |
1.07 |
|
Logistic (quantile) |
1.00 |
1.00 |
1.14 |
1.19 |
|
NegativeBinomial (CDF) |
2.66 |
1.06 |
1.91 |
1.00 |
1.16 |
NegativeBinomial (PDF) |
3.40 |
1.00 |
- |
1.45 |
|
NegativeBinomial (quantile) |
2.56 |
1.00 |
- |
2.97 |
3.91 |
NonCentralBeta (CDF) |
2.71 |
1.00 |
- |
1.27 |
|
NonCentralBeta (PDF) |
2.48 |
1.00 |
- |
1.13 |
|
NonCentralBeta (quantile) |
2.90 |
1.00 |
- |
3.91 |
|
NonCentralChiSquared (CDF) |
9.11 |
5.71 |
- |
18.21 |
1.00 |
NonCentralChiSquared (PDF) |
3.05 |
1.40 |
- |
1.00 |
|
NonCentralChiSquared (quantile) |
2.54 |
1.43 |
- |
34.65 |
1.00 |
NonCentralF (CDF) |
2.74 |
1.00 |
- |
1.74 |
1.66 |
NonCentralF (PDF) |
2.73 |
1.02 |
- |
1.00 |
|
NonCentralF (quantile) |
2.88 |
1.00 |
- |
5.53 |
1.34 |
NonCentralT (CDF) |
4.62 |
2.09 |
- |
1.00 |
|
NonCentralT (PDF) |
1.77 |
1.00 |
- |
1.27 |
|
NonCentralT (quantile) |
2.33 |
1.00 |
- |
2.29 |
|
Normal (CDF) |
2.59 |
1.55 |
1.00 |
1.50 |
3.12 |
Normal (PDF) |
1.03 |
1.00 |
- |
1.55 |
|
Normal (quantile) |
1.43 |
1.00 |
1.30 |
1.00 |
13.10 |
Pareto (CDF) |
1.00 |
1.04 |
1.06 |
||
Pareto (PDF) |
1.00 |
1.00 |
|||
Pareto (quantile) |
1.00 |
1.02 |
1.24 |
||
Poisson (CDF) |
2.16 |
1.00 |
3.03 |
1.70 |
1.27 |
Poisson (PDF) |
2.73 |
1.00 |
- |
1.54 |
|
Poisson (quantile) |
2.22 |
1.01 |
- |
1.00 |
4.49 |
Rayleigh (CDF) |
1.00 |
1.04 |
1.39 |
||
Rayleigh (PDF) |
1.03 |
1.00 |
|||
Rayleigh (quantile) |
1.00 |
1.00 |
1.37 |
||
SkewNormal (CDF) |
1.09 |
1.00 |
|||
SkewNormal (PDF) |
1.58 |
1.00 |
|||
SkewNormal (quantile) |
1.17 |
1.00 |
|||
StudentsT (CDF) |
6.46 |
2.24 |
1.00 |
1.03 |
1.25 |
StudentsT (PDF) |
5.36 |
1.30 |
- |
1.00 |
|
StudentsT (quantile) |
3.62 |
1.17 |
1.21 |
1.00 |
3.45 |
Weibull (CDF) |
1.00 |
1.00 |
1.10 |
1.17 |
|
Weibull (PDF) |
1.27 |
1.27 |
- |
1.00 |
|
Weibull (quantile) |
1.00 |
1.00 |
1.07 |
1.12 |