![]() |
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 21.7. Library Comparison with Microsoft Visual C++ version 14.0 on Windows x64
Function |
boost 1.61 |
math.h |
---|---|---|
cbrt |
1.00 |
1.44 |
cyl_bessel_j (integer order) |
1.00 |
2.11 |
cyl_neumann (integer order) |
1.57 |
1.00 |
erf |
1.10 |
1.00 |
erfc |
1.00 |
3.36 |
expm1 |
1.00 |
1.10 |
lgamma |
1.00 |
1.74 |
log1p |
1.08 |
1.00 |
tgamma |
1.00 |
12.12 |
On Linux with GCC, we can also compare to the TR1 functions, and to GSL and RMath:
Table 21.8. Library Comparison with GNU C++ version 5.3.0 on linux
Function |
boost 1.61 |
boost 1.61 |
tr1/cmath |
GSL 1.16 |
Rmath 3.0.2 |
math.h |
---|---|---|---|---|---|---|
assoc_laguerre |
1.36 |
1.00 |
1.20 |
1.12 |
- |
- |
assoc_legendre |
4.16 |
1.63 |
1.00 |
2.53 |
- |
- |
beta (incomplete) |
3.12 |
1.00 |
- |
1.36 |
- |
- |
beta |
4.74 |
1.01 |
1.00 |
2.57 |
1.65 |
- |
cbrt |
2.53 |
1.00 |
1.24 |
- |
- |
1.24 |
cyl_bessel_i (integer order) |
3.66 |
1.08 |
1.00 |
1.98 |
4.69 |
|
cyl_bessel_i |
6.78 |
1.95 |
1.00 |
4.47 |
8.16 |
- |
cyl_bessel_j (integer order) |
2.59 |
1.00 |
2.50 |
2.52 |
4.22 |
1.94 |
cyl_bessel_j |
2.83 |
1.05 |
1.00 |
2.28 |
1.20 |
- |
cyl_bessel_k (integer order) |
13.91 |
1.37 |
10.34 |
1.00 |
1.34 |
- |
cyl_bessel_k |
6.86 |
1.00 |
1.20 |
1.31 |
1.27 |
- |
cyl_neumann (integer order) |
2.20 |
1.00 |
3.26 |
2.42 |
4.95 |
1.78 |
cyl_neumann |
2.48 |
1.00 |
1.26 |
2.42 |
1.07 |
- |
digamma |
1.92 |
1.00 |
- |
2.69 |
4.31 |
- |
ellint_1 (complete) |
1.86 |
1.00 |
8.89 |
10.54 |
- |
|
ellint_1 |
1.94 |
1.00 |
2.31 |
2.51 |
- |
- |
ellint_2 (complete) |
1.71 |
1.00 |
15.23 |
17.31 |
- |
- |
ellint_2 |
2.32 |
1.00 |
1.90 |
2.17 |
- |
- |
ellint_3 (complete) |
2.23 |
1.00 |
1.66 |
1.98 |
||
ellint_3 |
2.75 |
1.00 |
1.59 |
1.77 |
- |
- |
ellint_rc |
1.57 |
1.00 |
- |
4.41 |
- |
- |
ellint_rd |
2.23 |
1.00 |
- |
1.64 |
- |
- |
ellint_rf |
1.51 |
1.00 |
- |
5.54 |
- |
- |
ellint_rj |
2.33 |
1.00 |
- |
11.31 |
- |
- |
erf |
1.00 |
- |
1.20 |
10.27 |
- |
1.20 |
erfc |
2.68 |
1.00 |
1.18 |
3.50 |
- |
1.14 |
expint (En) |
1.86 |
1.00 |
- |
4.87 |
- |
- |
expint |
2.47 |
1.00 |
5.34 |
3.76 |
- |
- |
expm1 |
1.00 |
1.10 |
1.00 |
- |
- |
1.00 |
gamma_p |
2.42 |
1.00 |
- |
4.77 |
1.61 |
- |
gamma_p_inv |
2.24 |
1.00 |
- |
- |
2.22 |
- |
gamma_q |
2.53 |
1.00 |
- |
5.70 |
1.78 |
- |
gamma_q_inv |
2.45 |
1.00 |
- |
- |
1.09 |
- |
ibeta |
3.47 |
1.28 |
- |
- |
1.00 |
- |
ibeta_inv |
2.58 |
1.00 |
- |
- |
26.72 |
- |
ibetac |
3.51 |
1.32 |
- |
- |
1.00 |
- |
ibetac_inv |
2.44 |
1.00 |
- |
- |
19.20 |
- |
jacobi_cn |
5.01 |
1.81 |
- |
1.00 |
- |
- |
jacobi_dn |
5.12 |
1.83 |
- |
1.00 |
- |
- |
jacobi_sn |
5.23 |
1.83 |
- |
1.00 |
- |
- |
laguerre |
1.09 |
1.00 |
1.25 |
1.18 |
- |
- |
legendre Q |
1.18 |
1.00 |
- |
1.09 |
- |
- |
legendre |
1.16 |
1.00 |
1.10 |
2.10 |
- |
- |
lgamma |
5.35 |
2.44 |
1.00 |
5.92 |
1.96 |
1.00 |
log1p |
1.09 |
1.09 |
1.00 |
- |
- |
1.00 |
polygamma |
8.69 |
2.21 |
- |
7.47 |
1.00 |
- |
sph_bessel |
1.71 |
1.00 |
2.11 |
2.68 |
- |
- |
sph_neumann |
8.32 |
3.88 |
6.46 |
1.00 |
- |
- |
tgamma (incomplete) |
2.35 |
1.00 |
- |
2.93 |
- |
- |
tgamma |
4.54 |
1.23 |
2.05 |
1.21 |
1.00 |
2.06 |
trigamma |
1.64 |
1.00 |
- |
39.41 |
12.09 |
- |
zeta |
2.71 |
1.00 |
752.52 |
1.52 |
- |
- |
And finally we can compare the statistical distributions to GSL, RMath and DCDFLIB:
Table 21.9. Distribution performance comparison with GNU C++ version 5.3.0 on linux
Function |
boost 1.61 |
Boost |
GSL |
Rmath 3.0.2 |
DCDFLIB |
---|---|---|---|---|---|
ArcSine (CDF) |
1.00 |
1.03 |
|||
ArcSine (PDF) |
1.00 |
1.00 |
|||
ArcSine (quantile) |
1.00 |
1.05 |
|||
Beta (CDF) |
2.40 |
1.00 |
2.66 |
1.64 |
2.39 |
Beta (PDF) |
2.52 |
1.00 |
- |
1.71 |
|
Beta (quantile) |
2.40 |
1.00 |
13.48 |
15.15 |
7.43 |
Binomial (CDF) |
1.72 |
1.00 |
1.40 |
1.17 |
1.23 |
Binomial (PDF) |
2.25 |
1.00 |
- |
1.07 |
|
Binomial (quantile) |
2.47 |
1.48 |
- |
1.00 |
6.21 |
Cauchy (CDF) |
1.38 |
1.33 |
1.00 |
1.81 |
|
Cauchy (PDF) |
1.12 |
1.00 |
- |
1.50 |
|
Cauchy (quantile) |
1.00 |
1.00 |
59.65 |
59.21 |
|
ChiSquared (CDF) |
2.28 |
1.06 |
16.73 |
1.23 |
1.00 |
ChiSquared (PDF) |
3.20 |
1.24 |
- |
1.00 |
|
ChiSquared (quantile) |
1.94 |
1.00 |
51.52 |
2.26 |
7.71 |
Exponential (CDF) |
1.05 |
1.00 |
1.21 |
1.53 |
|
Exponential (PDF) |
1.00 |
1.00 |
- |
1.27 |
|
Exponential (quantile) |
1.56 |
1.44 |
1.00 |
1.44 |
|
ExtremeValue (CDF) |
1.00 |
1.00 |
|||
ExtremeValue (PDF) |
1.01 |
1.00 |
|||
ExtremeValue (quantile) |
1.05 |
1.00 |
|||
F (CDF) |
1.77 |
1.00 |
1.59 |
1.13 |
1.10 |
F (PDF) |
2.39 |
1.00 |
- |
1.12 |
|
F (quantile) |
1.86 |
1.00 |
9.67 |
1.98 |
5.85 |
Gamma (CDF) |
2.48 |
1.01 |
6.12 |
1.40 |
1.00 |
Gamma (PDF) |
2.91 |
1.02 |
- |
1.00 |
|
Gamma (quantile) |
2.29 |
1.00 |
13.93 |
2.13 |
1.03 |
Geometric (CDF) |
1.00 |
1.08 |
1.00 |
2.08 |
|
Geometric (PDF) |
1.00 |
1.06 |
- |
7.15 |
|
Geometric (quantile) |
1.00 |
1.00 |
- |
2.18 |
|
Hypergeometric (CDF) |
12.07 |
6.58 |
1.61 |
1.00 |
|
Hypergeometric (PDF) |
25.41 |
13.51 |
- |
1.00 |
|
Hypergeometric (quantile) |
1.00 |
1.54 |
- |
1.60 |
|
InverseChiSquared (CDF) |
2.23 |
1.00 |
|||
InverseChiSquared (PDF) |
2.28 |
1.00 |
|||
InverseChiSquared (quantile) |
1.86 |
1.00 |
|||
InverseGamma (CDF) |
2.50 |
1.00 |
|||
InverseGamma (PDF) |
2.76 |
1.00 |
|||
InverseGamma (quantile) |
2.23 |
1.00 |
|||
InverseGaussian (CDF) |
1.00 |
1.00 |
|||
InverseGaussian (PDF) |
1.00 |
1.00 |
|||
InverseGaussian (quantile) |
1.01 |
1.00 |
|||
Laplace (CDF) |
1.35 |
1.35 |
1.00 |
||
Laplace (PDF) |
1.00 |
1.00 |
|||
Laplace (quantile) |
1.14 |
1.18 |
1.00 |
||
LogNormal (CDF) |
1.67 |
1.00 |
1.13 |
1.46 |
|
LogNormal (PDF) |
1.00 |
1.02 |
- |
1.08 |
|
LogNormal (quantile) |
1.45 |
1.32 |
1.00 |
1.32 |
|
Logistic (CDF) |
1.00 |
1.04 |
1.04 |
1.25 |
|
Logistic (PDF) |
1.00 |
1.03 |
- |
1.03 |
|
Logistic (quantile) |
1.09 |
1.12 |
1.00 |
1.27 |
|
NegativeBinomial (CDF) |
2.08 |
1.23 |
1.58 |
1.10 |
1.00 |
NegativeBinomial (PDF) |
2.19 |
1.00 |
- |
1.12 |
|
NegativeBinomial (quantile) |
1.74 |
1.00 |
- |
3.35 |
3.01 |
NonCentralBeta (CDF) |
2.25 |
1.18 |
- |
1.00 |
|
NonCentralBeta (PDF) |
2.13 |
1.23 |
- |
1.00 |
|
NonCentralBeta (quantile) |
2.15 |
1.00 |
- |
2.89 |
|
NonCentralChiSquared (CDF) |
10.17 |
6.32 |
- |
15.17 |
1.00 |
NonCentralChiSquared (PDF) |
2.81 |
1.55 |
- |
1.00 |
|
NonCentralChiSquared (quantile) |
3.29 |
1.72 |
- |
34.31 |
1.00 |
NonCentralF (CDF) |
1.96 |
1.04 |
- |
1.00 |
1.15 |
NonCentralF (PDF) |
2.39 |
1.25 |
- |
1.00 |
|
NonCentralF (quantile) |
2.30 |
1.15 |
- |
4.06 |
1.00 |
NonCentralT (CDF) |
5.04 |
3.10 |
- |
1.00 |
1.84 |
NonCentralT (PDF) |
1.82 |
1.19 |
- |
1.00 |
|
NonCentralT (quantile) |
1.88 |
1.12 |
- |
1.70 |
1.00 |
Normal (CDF) |
2.55 |
1.13 |
1.00 |
2.06 |
6.61 |
Normal (PDF) |
1.03 |
1.00 |
- |
1.25 |
|
Normal (quantile) |
2.03 |
1.58 |
1.00 |
1.36 |
17.58 |
Pareto (CDF) |
1.00 |
1.02 |
1.21 |
||
Pareto (PDF) |
1.01 |
1.00 |
|||
Pareto (quantile) |
1.04 |
1.25 |
1.00 |
||
Poisson (CDF) |
2.01 |
1.00 |
5.84 |
2.22 |
1.68 |
Poisson (PDF) |
2.09 |
1.00 |
- |
1.01 |
|
Poisson (quantile) |
1.99 |
1.00 |
- |
1.21 |
5.51 |
Rayleigh (CDF) |
1.10 |
1.05 |
1.00 |
||
Rayleigh (PDF) |
1.15 |
1.00 |
|||
Rayleigh (quantile) |
1.25 |
1.20 |
1.00 |
||
SkewNormal (CDF) |
1.09 |
1.00 |
|||
SkewNormal (PDF) |
1.53 |
1.00 |
|||
SkewNormal (quantile) |
1.07 |
1.00 |
|||
StudentsT (CDF) |
5.72 |
1.82 |
1.00 |
1.42 |
1.68 |
StudentsT (PDF) |
5.23 |
1.45 |
- |
1.00 |
|
StudentsT (quantile) |
3.04 |
1.00 |
1.37 |
1.16 |
4.48 |
Weibull (CDF) |
1.07 |
1.00 |
1.00 |
1.19 |
|
Weibull (PDF) |
1.48 |
1.47 |
- |
1.00 |
|
Weibull (quantile) |
1.00 |
1.00 |
1.16 |
1.08 |