Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Comparisons to Other Open Source Libraries

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] 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.

Comparison to GSL-1.13 and Cephes

All the results were measured on a 2.0GHz Intel T5800 Core 2 Duo, 4Gb RAM, Windows Vista machine, with the test program compiled with Microsoft Visual C++ 2009 using the /Ox option.

Function

Boost

GSL-1.9

Cephes

cbrt

1.00

(4.873e-007s)

N/A

1.00

(6.699e-007s)

log1p

1.00

(1.664e-007s)

1.00

(2.677e-007s)

1.00

(1.189e-007s)

expm1

1.00

(8.760e-008s)

1.00

(1.248e-007s)

1.00

(8.169e-008s)

tgamma

1.80

(2.997e-007s)

1.54

(2.569e-007s)

1.00

(1.666e-007s)

lgamma

2.20

(3.045e-007s)

4.14

(5.713e-007s)

1.00

(1.381e-007s)

erf and erfc

1.00

(1.483e-007s)

1.00

(7.052e-007s)

1.00

(1.722e-007s)

gamma_p and gamma_q

1.00

(6.182e-007s)

3.57

(2.209e-006s)

4.29

(2.651e-006s)

gamma_p_inv and gamma_q_inv

1.00

(1.943e-006s)

N/A

+INF [1]

ibeta and ibetac

1.00

(1.670e-006s)

1.16

(1.935e-006s)

1.16

(1.935e-006s)

ibeta_inv and ibetac_inv

1.00

(6.075e-006s)

N/A

2.45

(1.489e-005s)

cyl_bessel_j

17.89[2]

(4.248e-005s)

1.00

(5.214e-006s)

1.00

(2.374e-006s)

cyl_bessel_i

1.00

(5.924e-006s)

1.00

(4.487e-006s)

1.00

(4.823e-006s)

cyl_bessel_k

1.00

(2.783e-006s)

1.00

(3.927e-006s)

N/A

cyl_neumann

1.00

(4.465e-006s)

1.00

(1.230e-005s)

1.00

(4.977e-006s)

[1] Cephes gets stuck in an infinite loop while trying to execute our test cases.

[2] The performance here is dominated by a few cases where the parameters grow very large: faster asymptotic expansions are available, but are of limited (or even frankly terrible) precision. The same issue effects all of our Bessel function implementations, but doesn't necessarily show in the current performance data. More investigation is needed here.

Comparison to the R and DCDFLIB Statistical Libraries on Windows

All the results were measured on a 2.0GHz Intel T5800 Core 2 Duo, 4Gb RAM, Windows Vista machine, with the test program compiled with Microsoft Visual C++ 2009, and R-2.9.2 compiled in "standalone mode" with MinGW-4.3 (R-2.9.2 appears not to be buildable with Visual C++).

Table 56. A Comparison to the R Statistical Library on Windows XP

Statistical Function

Boost

R

DCDFLIB

Beta Distribution CDF

1.08

(1.385e-006s)

1.00

(1.278e-006s)

1.06

(1.349e-006s)

Beta Distribution Quantile

1.00

(4.975e-006s)

67.66[1]

(3.366e-004s)

4.23

(2.103e-005s)

Binomial Distribution CDF

1.06

(4.503e-007s)

1.81

(7.680e-007s)

1.00

(4.239e-007s)

Binomial Distribution Quantile

1.00

(3.254e-006s)

1.15

(3.746e-006s)

7.25

(2.358e-005s)

Cauchy Distribution CDF

1.00

(1.134e-007s)

1.08

(1.227e-007s)

NA

Cauchy Distribution Quantile

1.00

(1.203e-007s)

1.00

(1.203e-007s)

NA

Chi Squared Distribution CDF

1.21

(5.021e-007s)

2.83

(1.176e-006s)

1.00

(4.155e-007s)

Chi Squared Distribution Quantile

1.00

(1.930e-006s)

2.72

(5.243e-006s)

5.73

(1.106e-005s)

Exponential Distribution CDF

1.00

(3.798e-008s)

5.89

(2.236e-007s)

NA

Exponential Distribution Quantile

1.41

(9.006e-008s)

1.00

(6.380e-008s)

NA

Fisher F Distribution CDF

1.00

(9.556e-007s)

1.34

(1.283e-006s)

1.24

(1.183e-006s)

Fisher F Distribution Quantile

1.00

(6.987e-006s)

1.33

(9.325e-006s)

3.16

(2.205e-005s)

Gamma Distribution CDF

1.52

(6.240e-007s)

3.11

(1.279e-006s)

1.00

(4.111e-007s)

Gamma Distribution Quantile

1.24

(2.179e-006s)

6.25

(1.102e-005s)

1.00

(1.764e-006s)

__hypergeometric_distrib CDF

3.60[2]

(5.987e-007s)

1.00

(1.665e-007s)

NA

__hypergeometric_distrib Quantile

1.00

(5.684e-007s)

3.53

(2.004e-006s)

NA

Logistic Distribution CDF

1.00

(1.714e-007s)

5.24

(8.984e-007s)

NA

Logistic Distribution Quantile

1.02

(2.084e-007s)

1.00

(2.043e-007s)

NA

Log-normal Distribution CDF

1.00

(3.579e-007s)

1.49

(5.332e-007s)

NA

Log-normal Distribution Quantile

1.00

(9.622e-007s)

1.57

(1.507e-006s)

NA

Negative Binomial Distribution CDF

1.00

(6.227e-007s)

2.25

(1.403e-006s)

2.21

(1.378e-006s)

Negative Binomial Distribution Quantile

1.00

(8.594e-006s)

43.43[3]

(3.732e-004s)

3.48

(2.994e-005s)

Noncentral Chi Squared Distribution CDF

2.16

(3.926e-006s)

79.93

(1.450e-004s)

1.00

(1.814e-006s)

Noncentral Chi Squared Distribution Quantile

5.00

(3.393e-004s)

393.90[4]

(2.673e-002s)

1.00

(6.786e-005s)

Noncentral F Distribution CDF

1.59

(1.128e-005s)

1.00

(7.087e-006s)

1.00

(4.274e-006s)

Noncentral F Distribution Quantile

1.00

(4.750e-004s)

1.62

(7.681e-004s)

1.00

(4.274e-006s)

noncentral T distribution CDF

3.41

(1.852e-005s)

1.00

(5.436e-006s)

NA

noncentral T distribution Quantile

1.31

(5.768e-004s)

1.00[5]

(4.411e-004s)

NA

Normal Distribution CDF

1.00

(8.373e-008s)

1.68

(1.409e-007s)

6.01

(5.029e-007s)

Normal Distribution Quantile

1.29

(1.521e-007s)

1.00

(1.182e-007s)

10.85

(1.283e-006s)

Poisson Distribution CDF

1.18

(5.193e-007s)

2.98

(1.314e-006s)

1.00

(4.410e-007s)

Poisson Distribution

1.00

(1.203e-006s)

2.20

(2.642e-006s)

7.86

(9.457e-006s)

Students t Distribution CDF

1.00

(8.655e-007s)

1.06

(9.166e-007s)

1.04

(8.999e-007s)

Students t Distribution Quantile

1.00

(2.294e-006s)

1.36

(3.131e-006s)

4.82

(1.106e-005s)

Weibull Distribution CDF

1.00

(1.865e-007s)

2.33

(4.341e-007s)

NA

Weibull Distribution Quantile

1.00

(3.608e-007s)

1.22

(4.410e-007s)

NA

[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] This result is somewhat misleading: for small values of the parameters there is virtually no difference between the two libraries, but for large values the Boost implementation is much slower, albeit with much improved precision.

[3] 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

[4] 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.

[5] 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.


Comparison to the R Statistical Library on Linux

All the results were measured on a 2.0GHz Intel T5800 Core 2 Duo, 4Gb RAM, Ubuntu Linux 9 machine, with the test program and R-2.9.2 compiled with GNU G++ 4.3.3 using -O3 -DNDEBUG=1.

Table 57. A Comparison to the R Statistical Library on Linux

Statistical Function

Boost

R

DCDFLIB

Beta Distribution CDF

2.09

(3.189e-006s)

1.00

(1.526e-006s)

1.19

(1.822e-006s)

Beta Distribution Quantile

1.00

(1.185e-005s)

30.51[1]

(3.616e-004s)

2.52

(2.989e-005s)

Binomial Distribution CDF

4.41

(9.175e-007s)

3.59

(7.476e-007s)

1.00

(2.081e-007s)

Binomial Distribution Quantile

1.57

(6.925e-006s)

1.00

(4.407e-006s)

7.43

(3.274e-005s)

Cauchy Distribution CDF

1.00

(1.594e-007s)

1.04

(1.654e-007s)

NA

Cauchy Distribution Quantile

1.21

(1.752e-007s)

1.00

(1.448e-007s)

NA

Chi Squared Distribution CDF

2.61

(1.376e-006s)

2.36

(1.243e-006s)

1.00

(5.270e-007s)

Chi Squared Distribution Quantile

1.00

(4.252e-006s)

1.34

(5.700e-006s)

3.47

(1.477e-005s)

Exponential Distribution CDF

1.00

(1.342e-007s)

1.25

(1.677e-007s)

NA

Exponential Distribution Quantile

1.00

(8.827e-008s)

1.07

(9.470e-008s)

NA

Fisher F Distribution CDF

1.62

(2.324e-006s)

1.19

(1.711e-006s)

1.00

(1.437e-006s)

Fisher F Distribution Quantile

1.53

(1.577e-005s)

1.00

(1.033e-005s)

2.63

(2.719e-005s)

Gamma Distribution CDF

3.18

(1.582e-006s)

2.63

(1.309e-006s)

1.00

(4.980e-007s)

Gamma Distribution Quantile

2.19

(4.770e-006s)

6.94

(1.513e-005s)

1.00

(2.179e-006s)

__hypergeometric_distrib CDF

2.20[2]

(3.522e-007s)

1.00

(1.601e-007s)

NA

__hypergeometric_distrib Quantile

1.00

(8.279e-007s)

2.57

(2.125e-006s)

NA

Logistic Distribution CDF

1.00

(9.398e-008s)

2.75

(2.588e-007s)

NA

Logistic Distribution Quantile

1.00

(9.893e-008s)

1.30

(1.285e-007s)

NA

Log-normal Distribution CDF

1.00

(1.831e-007s)

1.39

(2.539e-007s)

NA

Log-normal Distribution Quantile

1.10

(5.551e-007s)

1.00

(5.037e-007s)

NA

Negative Binomial Distribution CDF

1.08

(1.563e-006s)

1.00

(1.444e-006s)

1.00

(1.444e-006s)

Negative Binomial Distribution Quantile

1.00

(1.700e-005s)

25.92[3]

(4.407e-004s)

1.93

(3.274e-005s)

Noncentral Chi Squared Distribution CDF

5.06

(2.841e-005s)

25.01

(1.405e-004s)

1.00

(5.617e-006s)

Noncentral Chi Squared Distribution Quantile

8.47

(1.879e-003s)

144.91[4]

(3.214e-002s)

1.00

(2.218e-004s)

Noncentral F Distribution CDF

10.33

(5.868e-005s)

1.42

(8.058e-006s)

1.00

(5.682e-006s)

Noncentral F Distribution Quantile

5.64

(7.869e-004s)

6.63

(9.256e-004s)

1.00

(1.396e-004s)

noncentral T distribution CDF

4.91

(3.357e-005s)

1.00

(6.844e-006s)

NA

noncentral T distribution Quantile

1.57

(9.265e-004s)

1.00[5]

(5.916e-004s)

NA

Normal Distribution CDF

1.00

(1.074e-007s)

1.16

(1.245e-007s)

5.36

(5.762e-007s)

Normal Distribution Quantile

1.28

(1.902e-007s)

1.00

(1.490e-007s)

10.35

(1.542e-006s)

Poisson Distribution CDF

2.43

(1.198e-006s)

2.25

(1.110e-006s)

1.00

(4.937e-007s)

Poisson Distribution

1.11

(3.032e-006s)

1.00

(2.724e-006s)

4.07

(1.110e-005s)

Students t Distribution CDF

2.17

(2.020e-006s)

1.00

(9.321e-007s)

1.10

(1.021e-006s)

Students t Distribution Quantile

1.18

(3.972e-006s)

1.00

(3.364e-006s)

3.89

(1.308e-005s)

Weibull Distribution CDF

1.00

(3.662e-007s)

1.04

(3.808e-007s)

NA

Weibull Distribution Quantile

1.00

(4.112e-007s)

1.05

(4.317e-007s)

NA

[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] This result is somewhat misleading: for small values of the parameters there is virtually no difference between the two libraries, but for large values the Boost implementation is much slower, albeit with much improved precision.

[3] 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

[4] 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.

[5] 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.



PrevUpHomeNext