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 to view this page for the latest version.
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. 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] 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
(85/85 tests selected)

1.00
(51ns)

1.22
(62ns)

cyl_bessel_j (integer order)
(267/268 tests selected)

1.00
(123ns)

1.50
(185ns)

cyl_neumann (integer order)
(428/428 tests selected)

1.01
(158ns)

1.00
(156ns)

erf
(950/950 tests selected)

2.15
(43ns)

1.00
(20ns)

erfc
(950/950 tests selected)

1.00
(54ns)

1.09
(59ns)

expm1
(80/80 tests selected)

1.10
(11ns)

1.00
(10ns)

lgamma
(400/400 tests selected)

1.00
(80ns)

1.60
(128ns)

log1p
(80/80 tests selected)

1.00
(14ns)

1.07
(15ns)

tgamma
(400/400 tests selected)

1.00
(74ns)

12.53
(927ns)


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
promote_double<false>

tr1/cmath

GSL 2.5

Rmath 3.6.3

math.h

assoc_laguerre
(2240/2240 tests selected)

1.09
(156ns)

1.00
(143ns)

1.03
(148ns)

1.16
(166ns)

-

-

assoc_legendre
(110/400 tests selected)

7.75
(279ns)

4.75
(171ns)

1.00
(36ns)

3.25
(117ns)

-

-

beta (incomplete)
(2682/3210 tests selected)

3.96
(2076ns)

1.00
(524ns)

-

1.20
(628ns)

-

-

beta
(2203/2204 tests selected)

7.51
(789ns)

1.00
(105ns)

1.38
(145ns)

3.14
(330ns)

2.27
(238ns)

-

cbrt
(85/85 tests selected)

2.32
(58ns)

1.00
(25ns)

1.28
(32ns)

-

-

1.24
(31ns)

cyl_bessel_i (integer order)
(494/526 tests selected)

4.76
(767ns)

1.08
(174ns)

1.00
(161ns)

1.83
(295ns)

5.25
(845ns)

-

cyl_bessel_i
(177/240 tests selected)

7.12
(1182ns)

1.44
(239ns)

1.00
(166ns)

4.14
(688ns)

7.92
(1315ns)

-

cyl_bessel_j (integer order)
(251/268 tests selected)

2.95
(319ns)

1.00
(108ns)

2.19
(237ns)

1.73
(187ns)

3.59
(388ns)

1.39
(150ns)

cyl_bessel_j
(433/451 tests selected)

3.16
(1067ns)

1.06
(359ns)

1.00
(338ns)

1.65
(558ns)

1.09
(368ns)

-

cyl_bessel_k (integer order)
(505/508 tests selected)

18.17
(3289ns)

1.00
(181ns)

9.73
(1761ns)

1.10
(200ns)

1.31
(238ns)

-

cyl_bessel_k
(96/279 tests selected)

10.37
(3962ns)

1.00
(382ns)

1.83
(700ns)

1.02
(389ns)

1.09
(416ns)

-

cyl_neumann (integer order)
(424/428 tests selected)

2.71
(466ns)

1.00
(172ns)

3.95
(679ns)

3.03
(522ns)

5.05
(869ns)

1.31
(225ns)

cyl_neumann
(428/450 tests selected)

14.08
(8826ns)

7.68
(4814ns)

1.21
(757ns)

1.26
(789ns)

1.00
(627ns)

-

digamma
(1019/1019 tests selected)

1.77
(62ns)

1.00
(35ns)

-

2.97
(104ns)

6.20
(217ns)

-

ellint_1 (complete)
(109/109 tests selected)

1.48
(93ns)

1.00
(63ns)

1.56
(98ns)

3.03
(191ns)

-

-

ellint_1
(627/629 tests selected)

2.01
(310ns)

1.00
(154ns)

1.24
(191ns)

2.13
(328ns)

-

-

ellint_2 (complete)
(109/110 tests selected)

1.76
(44ns)

1.00
(25ns)

8.76
(219ns)

15.24
(381ns)

-

-

ellint_2
(527/530 tests selected)

2.98
(704ns)

1.00
(236ns)

1.25
(294ns)

2.15
(507ns)

-

-

ellint_3 (complete)
(0/500 tests selected)

-nan
(0ns)

-nan
(0ns)

-nan
(0ns)

-nan
(0ns)

-

-

ellint_3
(22/845 tests selected)

3.52
(609ns)

1.25
(217ns)

1.00
(173ns)

1.36
(235ns)

-

-

ellint_rc
(201/201 tests selected)

2.13
(66ns)

1.00
(31ns)

-

5.03
(156ns)

-

-

ellint_rd
(7588/7588 tests selected)

3.34
(428ns)

1.00
(128ns)

-

1.88
(240ns)

-

-

ellint_rf
(7788/7788 tests selected)

1.71
(84ns)

1.00
(49ns)

-

4.65
(228ns)

-

-

ellint_rj
(7642/8032 tests selected)

3.04
(426ns)

1.00
(140ns)

-

10.84
(1518ns)

-

-

erf
(950/950 tests selected)

1.71
(41ns)

-

1.00
(24ns)

4.21
(101ns)

-

1.00
(24ns)

erfc
(950/950 tests selected)

3.18
(89ns)

2.32
(65ns)

1.00
(28ns)

3.32
(93ns)

-

1.00
(28ns)

expint (En)
(1059/1059 tests selected)

2.12
(242ns)

1.00
(114ns)

-

3.86
(440ns)

-

-

expint
(436/436 tests selected)

2.02
(85ns)

1.00
(42ns)

2.60
(109ns)

4.10
(172ns)

-

-

expm1
(80/80 tests selected)

1.19
(19ns)

1.00
(16ns)

1.00
(16ns)

-

-

1.06
(17ns)

gamma_p
(1379/1379 tests selected)

2.64
(618ns)

1.11
(260ns)

-

1.79
(420ns)

1.00
(234ns)

-

gamma_p_inv
(559/559 tests selected)

2.24
(2328ns)

1.00
(1038ns)

-

-

1.17
(1211ns)

-

gamma_q
(1371/1379 tests selected)

2.59
(629ns)

1.04
(253ns)

-

2.02
(492ns)

1.00
(243ns)

-

gamma_q_inv
(78/559 tests selected)

2.57
(2016ns)

1.22
(958ns)

-

-

1.00
(783ns)

-

ibeta
(3210/3210 tests selected)

5.33
(1979ns)

1.41
(524ns)

-

-

1.00
(371ns)

-

ibeta_inv
(1204/1210 tests selected)

2.92
(5552ns)

1.00
(1902ns)

-

-

2.73
(5188ns)

-

ibetac
(3210/3210 tests selected)

4.44
(2008ns)

1.31
(590ns)

-

-

1.00
(452ns)

-

ibetac_inv
(1201/1210 tests selected)

2.99
(5533ns)

1.00
(1853ns)

-

-

2.43
(4504ns)

-

jacobi_cn
(2368/2757 tests selected)

7.00
(483ns)

2.36
(163ns)

-

1.00
(69ns)

-

-

jacobi_dn
(2368/2757 tests selected)

7.19
(503ns)

2.47
(173ns)

-

1.00
(70ns)

-

-

jacobi_sn
(2368/2757 tests selected)

6.20
(614ns)

1.82
(180ns)

-

1.00
(99ns)

-

-

laguerre
(280/280 tests selected)

1.02
(92ns)

1.00
(90ns)

1.10
(99ns)

1.49
(134ns)

-

-

legendre Q
(300/300 tests selected)

1.24
(390ns)

1.00
(314ns)

-

1.08
(340ns)

-

-

legendre
(300/300 tests selected)

1.12
(282ns)

1.00
(251ns)

1.16
(290ns)

1.31
(328ns)

-

-

lgamma
(400/400 tests selected)

5.30
(265ns)

2.34
(117ns)

1.04
(52ns)

4.08
(204ns)

2.08
(104ns)

1.00
(50ns)

log1p
(80/80 tests selected)

1.18
(20ns)

1.29
(22ns)

1.00
(17ns)

-

-

1.00
(17ns)

polygamma
(823/1535 tests selected)

23.31
(8883ns)

1.98
(756ns)

-

1.57
(598ns)

1.00
(381ns)

-

sph_bessel
(483/483 tests selected)

1.91
(1122ns)

1.00
(588ns)

3.14
(1844ns)

1.96
(1155ns)

-

-

sph_neumann
(284/284 tests selected)

7.16
(2842ns)

2.56
(1015ns)

7.44
(2953ns)

1.00
(397ns)

-

-

tgamma (incomplete)
(1266/1379 tests selected)

2.90
(669ns)

1.00
(231ns)

-

2.19
(505ns)

-

-

tgamma
(400/400 tests selected)

4.10
(472ns)

1.25
(144ns)

1.33
(153ns)

1.03
(118ns)

1.00
(115ns)

1.57
(180ns)

trigamma
(659/659 tests selected)

2.08
(25ns)

1.00
(12ns)

-

53.75
(645ns)

30.92
(371ns)

-

zeta
(448/448 tests selected)

4.21
(455ns)

1.00
(108ns)

1078.95
(116527ns)

2.03
(219ns)

-

-


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
promote_double<false>

GSL

Rmath 3.6.3

DCDFLIB

ArcSine (CDF)

1.06
(35ns)

1.00
(33ns)

ArcSine (PDF)

1.00
(5ns)

1.00
(5ns)

ArcSine (quantile)

1.04
(24ns)

1.00
(23ns)

Beta (CDF)

3.14
(437ns)

1.00
(139ns)

3.24
(450ns)

1.94
(269ns)

2.52
(350ns)

Beta (PDF)

3.50
(360ns)

1.00
(103ns)

-

2.31
(238ns)

Beta (quantile)

2.61
(2587ns)

1.00
(991ns)

14.97
(14833ns)

1.83
(1809ns)

7.24
(7178ns)

Binomial (CDF)

2.58
(837ns)

1.00
(324ns)

2.16
(701ns)

1.49
(484ns)

1.65
(536ns)

Binomial (PDF)

2.66
(322ns)

1.00
(121ns)

-

1.83
(222ns)

Binomial (quantile)

2.96
(3917ns)

1.17
(1548ns)

-

1.00
(1323ns)

6.59
(8716ns)

Cauchy (CDF)

1.00
(23ns)

1.00
(23ns)

1.57
(36ns)

1.57
(36ns)

Cauchy (PDF)

1.00
(3ns)

1.00
(3ns)

-

5.67
(17ns)

Cauchy (quantile)

1.00
(45ns)

1.07
(48ns)

75.60
(3402ns)

1.93
(87ns)

ChiSquared (CDF)

6.00
(1002ns)

3.03
(506ns)

9.54
(1593ns)

1.46
(243ns)

1.00
(167ns)

ChiSquared (PDF)

3.43
(295ns)

1.00
(86ns)

-

1.28
(110ns)

ChiSquared (quantile)

2.04
(1664ns)

1.00
(815ns)

18.96
(15454ns)

1.84
(1501ns)

6.40
(5220ns)

Exponential (CDF)

1.00
(19ns)

1.47
(28ns)

1.68
(32ns)

1.84
(35ns)

Exponential (PDF)

1.00
(30ns)

1.17
(35ns)

-

1.57
(47ns)

Exponential (quantile)

1.00
(23ns)

1.13
(26ns)

1.48
(34ns)

1.57
(36ns)

ExtremeValue (CDF)

1.00
(57ns)

1.02
(58ns)

ExtremeValue (PDF)

1.06
(90ns)

1.00
(85ns)

ExtremeValue (quantile)

1.04
(53ns)

1.00
(51ns)

F (CDF)

2.83
(817ns)

1.00
(289ns)

2.52
(729ns)

1.38
(399ns)

1.51
(436ns)

F (PDF)

2.87
(361ns)

1.00
(126ns)

-

1.24
(156ns)

F (quantile)

2.11
(2615ns)

1.00
(1241ns)

11.07
(13741ns)

2.09
(2589ns)

5.32
(6604ns)

Gamma (CDF)

4.10
(714ns)

1.53
(267ns)

3.93
(684ns)

1.43
(248ns)

1.00
(174ns)

Gamma (PDF)

3.87
(437ns)

1.00
(113ns)

-

1.35
(153ns)

Gamma (quantile)

2.83
(1827ns)

1.17
(755ns)

11.04
(7119ns)

2.25
(1454ns)

1.00
(645ns)

Geometric (CDF)

1.00
(25ns)

1.08
(27ns)

2.12
(53ns)

2.32
(58ns)

Geometric (PDF)

1.00
(23ns)

1.00
(23ns)

-

15.78
(363ns)

Geometric (quantile)

1.00
(25ns)

1.12
(28ns)

-

2.88
(72ns)

Hypergeometric (CDF)

95.49
(66745ns)

88.59
(61922ns)

1.00
(699ns)

1.04
(729ns)

Hypergeometric (PDF)

141.15
(73824ns)

121.97
(63790ns)

-

1.00
(523ns)

Hypergeometric (quantile)

1.38
(131293ns)

1.75
(166268ns)

-

1.00
(95222ns)

InverseChiSquared (CDF)

1.92
(1538ns)

1.00
(803ns)

InverseChiSquared (PDF)

2.72
(367ns)

1.00
(135ns)

InverseChiSquared (quantile)

1.76
(2328ns)

1.00
(1322ns)

InverseGamma (CDF)

2.25
(806ns)

1.00
(359ns)

InverseGamma (PDF)

3.41
(515ns)

1.00
(151ns)

InverseGamma (quantile)

2.37
(2187ns)

1.00
(921ns)

InverseGaussian (CDF)

1.00
(236ns)

1.03
(242ns)

InverseGaussian (PDF)

1.00
(23ns)

1.00
(23ns)

InverseGaussian (quantile)

1.00
(3530ns)

1.08
(3823ns)

Laplace (CDF)

1.00
(41ns)

1.02
(42ns)

1.20
(49ns)

Laplace (PDF)

1.00
(42ns)

1.02
(43ns)

Laplace (quantile)

1.00
(39ns)

1.03
(40ns)

1.08
(42ns)

LogNormal (CDF)

2.14
(225ns)

1.34
(141ns)

1.00
(105ns)

1.14
(120ns)

LogNormal (PDF)

1.00
(74ns)

1.03
(76ns)

-

1.00
(74ns)

LogNormal (quantile)

1.35
(105ns)

1.29
(101ns)

1.00
(78ns)

1.03
(80ns)

Logistic (CDF)

1.00
(41ns)

1.00
(41ns)

1.73
(71ns)

1.15
(47ns)

Logistic (PDF)

1.00
(43ns)

1.00
(43ns)

-

1.07
(46ns)

Logistic (quantile)

1.00
(37ns)

1.00
(37ns)

1.14
(42ns)

1.19
(44ns)

NegativeBinomial (CDF)

2.66
(1354ns)

1.06
(540ns)

1.91
(974ns)

1.00
(509ns)

1.16
(589ns)

NegativeBinomial (PDF)

3.40
(445ns)

1.00
(131ns)

-

1.45
(190ns)

NegativeBinomial (quantile)

2.56
(7468ns)

1.00
(2918ns)

-

2.97
(8664ns)

3.91
(11414ns)

NonCentralBeta (CDF)

2.71
(2083ns)

1.00
(769ns)

-

1.27
(976ns)

NonCentralBeta (PDF)

2.48
(1265ns)

1.00
(511ns)

-

1.13
(578ns)

NonCentralBeta (quantile)

2.90
(55809ns)

1.00
(19273ns)

-

3.91
(75343ns)

NonCentralChiSquared (CDF)

9.11
(4498ns)

5.71
(2821ns)

-

18.21
(8997ns)

1.00
(494ns)

NonCentralChiSquared (PDF)

3.05
(953ns)

1.40
(436ns)

-

1.00
(312ns)

NonCentralChiSquared (quantile)

2.54
(31465ns)

1.43
(17712ns)

-

34.65
(428458ns)

1.00
(12366ns)

NonCentralF (CDF)

2.74
(1828ns)

1.00
(667ns)

-

1.74
(1160ns)

1.66
(1104ns)

NonCentralF (PDF)

2.73
(1506ns)

1.02
(564ns)

-

1.00
(551ns)

NonCentralF (quantile)

2.88
(29414ns)

1.00
(10228ns)

-

5.53
(56602ns)

1.34
(13703ns)

NonCentralT (CDF)

4.62
(6416ns)

2.09
(2907ns)

-

1.00
(1389ns)

NonCentralT (PDF)

1.77
(4034ns)

1.00
(2284ns)

-

1.27
(2898ns)

NonCentralT (quantile)

2.33
(68590ns)

1.00
(29386ns)

-

2.29
(67338ns)

Normal (CDF)

2.59
(150ns)

1.55
(90ns)

1.00
(58ns)

1.50
(87ns)

3.12
(181ns)

Normal (PDF)

1.03
(34ns)

1.00
(33ns)

-

1.55
(51ns)

Normal (quantile)

1.43
(57ns)

1.00
(40ns)

1.30
(52ns)

1.00
(40ns)

13.10
(524ns)

Pareto (CDF)

1.00
(49ns)

1.04
(51ns)

1.06
(52ns)

Pareto (PDF)

1.00
(86ns)

1.00
(86ns)

Pareto (quantile)

1.00
(51ns)

1.02
(52ns)

1.24
(63ns)

Poisson (CDF)

2.16
(264ns)

1.00
(122ns)

3.03
(370ns)

1.70
(207ns)

1.27
(155ns)

Poisson (PDF)

2.73
(218ns)

1.00
(80ns)

-

1.54
(123ns)

Poisson (quantile)

2.22
(1193ns)

1.01
(540ns)

-

1.00
(537ns)

4.49
(2409ns)

Rayleigh (CDF)

1.00
(23ns)

1.04
(24ns)

1.39
(32ns)

Rayleigh (PDF)

1.03
(37ns)

1.00
(36ns)

Rayleigh (quantile)

1.00
(27ns)

1.00
(27ns)

1.37
(37ns)

SkewNormal (CDF)

1.09
(691ns)

1.00
(633ns)

SkewNormal (PDF)

1.58
(174ns)

1.00
(110ns)

SkewNormal (quantile)

1.17
(6788ns)

1.00
(5813ns)

StudentsT (CDF)

6.46
(1893ns)

2.24
(656ns)

1.00
(293ns)

1.03
(303ns)

1.25
(367ns)

StudentsT (PDF)

5.36
(724ns)

1.30
(176ns)

-

1.00
(135ns)

StudentsT (quantile)

3.62
(2959ns)

1.17
(954ns)

1.21
(986ns)

1.00
(818ns)

3.45
(2822ns)

Weibull (CDF)

1.00
(69ns)

1.00
(69ns)

1.10
(76ns)

1.17
(81ns)

Weibull (PDF)

1.27
(117ns)

1.27
(117ns)

-

1.00
(92ns)

Weibull (quantile)

1.00
(69ns)

1.00
(69ns)

1.07
(74ns)

1.12
(77ns)



PrevUpHomeNext