...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
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.
Caution | |
---|---|
You should exercise extreme caution when interpreting these results, relative performance may vary by platform, 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. |
All the results were measured on a 2.8GHz Intel Pentium 4, 2Gb RAM, Windows
XP machine, with all the libraries compiled with Microsoft Visual C++ 2005
using the /Ox
/arch:SSE2
options.
Function |
Boost |
GSL-1.9 |
Cephes |
---|---|---|---|
1.50
(2.566e-007s)
|
1.54
(2.627e-007s)
|
1.00
(1.709e-007s)
|
|
1.73
(2.688e-007s)
|
3.61
(5.621e-007s)
|
1.00
(1.556e-007s)
|
|
1.00
(9.504e-007s)
|
2.15
(2.042e-006s)
|
2.57
(2.439e-006s)
|
|
1.00
(3.631e-006s)
|
N/A |
+INF [1] |
|
1.00
(1.852e-006s)
|
1.07
(1.974e-006s)
|
1.07
(1.974e-006s)
|
|
ibeta_inv and ibetac_inv |
1.00
(7.311e-006s)
|
N/A |
2.24
(1.637e-005s)
|
[1] Cephes gets stuck in an infinite loop while trying to execute our test cases. |
All the results were measured on a 2.8GHz Intel Pentium 4, 2Gb RAM, Windows XP machine, with the test program compiled with Microsoft Visual C++ 2005, and R-2.5.0 compiled in "standalone mode" with MinGW-3.4 (R-2.5.0 appears not to be buildable with Visual C++).
Table 51. A Comparison to the R Statistical Library on Windows XP
Statistical Function |
Boost |
R |
---|---|---|
1.20
(1.916e-006s)
|
1.00
(1.597e-006s)
|
|
Beta Distribution Quantile |
1.00
(6.570e-006s)
|
74.66 [1]
(4.905e-004s)
|
1.00
(5.276e-007s)
|
2.45
(1.293e-006s)
|
|
Binomial Distribution Quantile |
1.00
(4.013e-006s)
|
1.32
(5.280e-006s)
|
1.00
(1.231e-007s)
|
1.28
(1.576e-007s)
|
|
Cauchy Distribution Quantile |
1.00
(1.498e-007s)
|
1.00
(1.498e-007s)
|
1.00
(7.889e-007s)
|
2.48
(1.955e-006s)
|
|
Chi Squared Distribution Quantile |
1.00
(4.303e-006s)
|
1.61
(6.925e-006s)
|
1.00
(1.955e-007s)
|
1.97
(3.844e-007s)
|
|
Exponential Distribution Quantile |
1.07
(1.206e-007s)
|
1.00
(1.126e-007s)
|
1.00
(1.309e-006s)
|
2.12
(2.780e-006s)
|
|
Fisher F Distribution Quantile |
1.00
(7.204e-006s)
|
1.78
(1.280e-005s)
|
1.00
(1.076e-006s)
|
2.07
(2.227e-006s)
|
|
Gamma Distribution Quantile |
1.00
(5.189e-006s)
|
1.14
(5.937e-006s)
|
1.00
(2.078e-007s)
|
1.41
(2.930e-007s)
|
|
Log-normal Distribution Quantile |
1.00
(6.692e-007s)
|
1.63
(1.090e-006s)
|
1.00
(9.005e-007s)
|
2.42
(2.178e-006s)
|
|
Negative Binomial Distribution Quantile |
1.00
(9.601e-006s)
|
53.59 [2]
(5.145e-004s)
|
1.00
(5.926e-008s)
|
3.01
(1.785e-007s)
|
|
Normal Distribution Quantile |
1.00
(1.248e-007s)
|
1.05
(1.311e-007s)
|
1.00
(8.999e-007s)
|
2.42
(2.175e-006s)
|
|
1.00
(1.853e-006s)
|
2.17
(4.014e-006s)
|
|
1.00
(1.223e-006s)
|
1.13
(1.376e-006s)
|
|
Students t Distribution Quantile |
1.00
(2.570e-006s)
|
1.04
(2.668e-006s)
|
1.00
(4.741e-007s)
|
1.46
(6.943e-007s)
|
|
Weibull Distribution Quantile |
1.00
(7.926e-007s)
|
1.08
(8.542e-007s)
|
[1] There are a small number of our test cases where the R library fails to converge on a result: these tend to dominate the performance result. [2] The R library appears to use a linear-search strategy, that can perform very badly in a small number of pathological cases, but may or may not be more efficient in "typical" cases |
All the results were measured on a 2.8GHz Intel Pentium 4, 2Gb RAM, Mandriva Linux machine, with the test program and R-2.5.0 compiled with GNU G++ 4.2.0.
Table 52. A Comparison to the R Statistical Library on Linux
Statistical Function |
Boost |
R |
---|---|---|
1.71
(3.508e-006s)
|
1.00
(2.050e-006s)
|
|
Beta Distribution Quantile |
1.00
(1.294e-005s)
|
44.06 [1]
(5.701e-004s)
|
1.22
(1.342e-006s)
|
1.00
(1.104e-006s)
|
|
Binomial Distribution Quantile |
1.36
(7.083e-006s)
|
1.00
(5.194e-006s)
|
1.00
(1.372e-007s)
|
1.47
(2.017e-007s)
|
|
Cauchy Distribution Quantile |
1.00
(1.542e-007s)
|
1.14
(1.752e-007s)
|
1.04
(1.820e-006s)
|
1.00
(1.753e-006s)
|
|
Chi Squared Distribution Quantile |
1.39
(9.345e-006s)
|
1.00
(6.728e-006s)
|
1.00
(2.195e-007s)
|
1.17
(2.561e-007s)
|
|
Exponential Distribution Quantile |
1.00
(1.123e-007s)
|
1.03
(1.155e-007s)
|
1.00
(2.744e-006s)
|
1.08
(2.970e-006s)
|
|
Fisher F Distribution Quantile |
1.14
(1.550e-005s)
|
1.00
(1.359e-005s)
|
1.29
(2.578e-006s)
|
1.00
(1.992e-006s)
|
|
Gamma Distribution Quantile |
1.77
(1.020e-005s)
|
1.00
(5.757e-006s)
|
1.00
(1.782e-007s)
|
2.00
(3.564e-007s)
|
|
Log-normal Distribution Quantile |
1.00
(7.093e-007s)
|
1.07
(7.607e-007s)
|
1.03
(2.209e-006s)
|
1.00
(2.141e-006s)
|
|
Negative Binomial Distribution Quantile |
1.00
(1.826e-005s)
|
30.07 [2]
(5.490e-004s)
|
1.00
(8.542e-008s)
|
2.09
(1.782e-007s)
|
|
Normal Distribution Quantile |
1.00
(1.362e-007s)
|
1.26
(1.722e-007s)
|
1.10
(1.953e-006s)
|
1.00
(1.775e-006s)
|
|
1.12
(4.214e-006s)
|
1.00
(3.752e-006s)
|
|
1.55
(2.441e-006s)
|
1.00
(1.576e-006s)
|
|
Students t Distribution Quantile |
1.33
(3.972e-006s)
|
1.00
(2.990e-006s)
|
1.00
(6.640e-007s)
|
1.06
(7.031e-007s)
|
|
Weibull Distribution Quantile |
1.00
(7.504e-007s)
|
1.03
(7.710e-007s)
|
[1] There are a small number of our test cases where the R library fails to converge on a result: these tend to dominate the performance result. [2] The R library appears to use a linear-search strategy, that can perform very badly in a small number of pathological cases, but may or may not be more efficient in "typical" cases |