...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
By running our performance test suite multiple times, we can compare the effect
of different compilers: as might be expected, the differences are generally
small compared to say disabling internal use of long
double
. However, there are still gains
to be main, particularly from some of the commercial offerings:
Table 23.12. Compiler Comparison on Windows x64
Function |
Microsoft Visual C++ version 14.2 |
GNU C++ version 9.2.0 |
GNU C++ version 9.2.0 |
---|---|---|---|
assoc_laguerre |
1.41 |
1.08 |
1.00 |
assoc_legendre |
1.76 |
1.36 |
1.00 |
beta |
1.00 |
2.62 |
1.93 |
beta (incomplete) |
1.00 |
2.95 |
1.58 |
cbrt |
3.40 |
4.67 |
1.00 |
cyl_bessel_i |
1.00 |
3.38 |
1.38 |
cyl_bessel_i (integer order) |
1.00 |
3.06 |
1.00 |
cyl_bessel_j |
1.00 |
2.39 |
1.35 |
cyl_bessel_j (integer order) |
1.28 |
1.92 |
1.00 |
cyl_bessel_k |
1.11 |
19.68 |
1.00 |
cyl_bessel_k (integer order) |
1.06 |
18.17 |
1.00 |
cyl_neumann |
1.17 |
1.76 |
1.00 |
cyl_neumann (integer order) |
1.00 |
2.20 |
1.59 |
digamma |
1.00 |
3.45 |
2.30 |
ellint_1 |
1.57 |
1.41 |
1.00 |
ellint_1 (complete) |
1.64 |
1.64 |
1.00 |
ellint_2 |
1.81 |
1.50 |
1.00 |
ellint_2 (complete) |
3.11 |
2.11 |
1.00 |
ellint_3 |
3.47 |
1.68 |
1.00 |
ellint_3 (complete) |
inf |
-nan(ind) |
-nan(ind) |
ellint_rc |
1.55 |
2.21 |
1.00 |
ellint_rd |
1.32 |
1.26 |
1.00 |
ellint_rf |
1.27 |
1.94 |
1.00 |
ellint_rj |
1.46 |
2.29 |
1.00 |
erf |
1.30 |
1.85 |
1.00 |
erfc |
1.06 |
1.76 |
1.00 |
expint |
1.00 |
3.41 |
2.22 |
expint (En) |
1.00 |
1.94 |
1.29 |
expm1 |
1.00 |
3.00 |
2.36 |
gamma_p |
1.00 |
2.00 |
1.17 |
gamma_p_inv |
1.00 |
1.85 |
1.15 |
gamma_q |
1.00 |
2.10 |
1.21 |
gamma_q_inv |
1.00 |
1.66 |
1.14 |
ibeta |
1.00 |
2.63 |
1.31 |
ibeta_inv |
1.00 |
2.49 |
1.48 |
ibetac |
1.00 |
2.60 |
1.27 |
ibetac_inv |
1.00 |
2.85 |
1.74 |
jacobi_cn |
1.00 |
3.10 |
2.00 |
jacobi_dn |
1.00 |
3.03 |
1.93 |
jacobi_sn |
1.00 |
2.81 |
1.73 |
laguerre |
1.02 |
1.07 |
1.00 |
legendre |
1.11 |
1.25 |
1.00 |
legendre Q |
1.00 |
1.51 |
1.15 |
lgamma |
1.00 |
2.67 |
2.00 |
log1p |
1.00 |
2.07 |
1.21 |
polygamma |
1.00 |
1.85 |
1.91 |
sph_bessel |
1.01 |
1.48 |
1.00 |
sph_neumann |
1.07 |
2.96 |
1.00 |
tgamma |
1.00 |
3.50 |
2.14 |
tgamma (incomplete) |
1.00 |
2.30 |
1.64 |
trigamma |
1.00 |
2.83 |
1.17 |
zeta |
1.00 |
2.65 |
1.89 |
Table 23.13. Compiler Comparison on linux
Function |
GNU C++ version 9.2.1 20191008 |
GNU C++ version 9.2.1 20191008 |
Clang version 9.0.0 (tags/RELEASE_900/final) |
Clang version 9.0.0 (tags/RELEASE_900/final) |
Intel C++ C++0x mode version 1910 |
Intel C++ C++0x mode version 1910 |
---|---|---|---|---|---|---|
assoc_laguerre |
1.17 |
1.08 |
1.72 |
1.31 |
1.15 |
1.00 |
assoc_legendre |
2.91 |
1.78 |
2.86 |
1.00 |
2.79 |
2.16 |
beta |
10.52 |
1.40 |
10.56 |
1.73 |
6.07 |
1.00 |
beta (incomplete) |
4.98 |
1.26 |
5.44 |
1.00 |
3.15 |
1.16 |
cbrt |
2.52 |
1.09 |
2.35 |
1.22 |
1.91 |
1.00 |
cyl_bessel_i |
5.05 |
1.02 |
10.73 |
1.74 |
3.99 |
1.00 |
cyl_bessel_i (integer order) |
4.41 |
1.00 |
5.09 |
1.03 |
3.63 |
1.12 |
cyl_bessel_j |
3.80 |
1.28 |
4.72 |
1.55 |
3.05 |
1.00 |
cyl_bessel_j (integer order) |
3.10 |
1.05 |
4.73 |
1.00 |
2.30 |
1.12 |
cyl_bessel_k |
10.37 |
1.00 |
11.55 |
1.52 |
12.41 |
1.09 |
cyl_bessel_k (integer order) |
19.23 |
1.06 |
19.78 |
1.27 |
20.02 |
1.00 |
cyl_neumann |
2.18 |
1.19 |
3.23 |
1.31 |
2.35 |
1.00 |
cyl_neumann (integer order) |
3.67 |
1.35 |
4.49 |
1.15 |
2.87 |
1.00 |
digamma |
2.30 |
1.30 |
3.11 |
1.33 |
1.85 |
1.00 |
ellint_1 |
2.26 |
1.12 |
6.96 |
1.25 |
3.22 |
1.00 |
ellint_1 (complete) |
4.65 |
3.15 |
6.00 |
1.15 |
1.90 |
1.00 |
ellint_2 |
3.81 |
1.28 |
8.95 |
1.36 |
4.36 |
1.00 |
ellint_2 (complete) |
1.83 |
1.04 |
6.25 |
1.25 |
2.00 |
1.00 |
ellint_3 |
3.27 |
1.17 |
5.37 |
1.32 |
2.84 |
1.00 |
ellint_3 (complete) |
-nan |
-nan |
-nan |
-nan |
-nan |
-nan |
ellint_rc |
2.75 |
1.29 |
4.71 |
1.42 |
1.83 |
1.00 |
ellint_rd |
4.37 |
1.31 |
9.24 |
1.31 |
4.17 |
1.00 |
ellint_rf |
2.47 |
1.44 |
4.62 |
1.32 |
1.85 |
1.00 |
ellint_rj |
4.14 |
1.36 |
7.18 |
1.31 |
3.33 |
1.00 |
erf |
1.69 |
1.28 |
2.56 |
1.38 |
1.34 |
1.00 |
erfc |
1.65 |
1.20 |
2.46 |
1.26 |
1.22 |
1.00 |
expint |
2.93 |
1.45 |
2.90 |
1.31 |
2.21 |
1.00 |
expint (En) |
2.42 |
1.14 |
2.76 |
1.19 |
1.84 |
1.00 |
expm1 |
1.90 |
1.60 |
1.50 |
1.40 |
1.80 |
1.00 |
gamma_p |
2.43 |
1.02 |
2.95 |
1.00 |
2.15 |
1.03 |
gamma_p_inv |
2.37 |
1.06 |
2.73 |
1.06 |
1.92 |
1.00 |
gamma_q |
2.49 |
1.00 |
3.28 |
1.11 |
2.18 |
1.04 |
gamma_q_inv |
2.73 |
1.30 |
3.22 |
1.30 |
1.73 |
1.00 |
ibeta |
4.56 |
1.21 |
4.60 |
1.00 |
3.35 |
1.13 |
ibeta_inv |
3.22 |
1.10 |
3.49 |
1.03 |
2.58 |
1.00 |
ibetac |
4.34 |
1.27 |
4.34 |
1.00 |
3.11 |
1.17 |
ibetac_inv |
3.32 |
1.11 |
3.55 |
1.03 |
2.48 |
1.00 |
jacobi_cn |
3.74 |
1.26 |
4.98 |
1.61 |
2.67 |
1.00 |
jacobi_dn |
3.64 |
1.25 |
4.70 |
1.49 |
2.72 |
1.00 |
jacobi_sn |
4.99 |
1.46 |
5.20 |
1.72 |
2.57 |
1.00 |
laguerre |
1.11 |
1.08 |
1.41 |
1.11 |
1.17 |
1.00 |
legendre |
1.12 |
1.00 |
1.21 |
1.30 |
1.39 |
1.08 |
legendre Q |
1.24 |
1.00 |
1.29 |
1.14 |
1.42 |
1.11 |
lgamma |
2.65 |
1.17 |
3.86 |
1.24 |
1.90 |
1.00 |
log1p |
1.11 |
1.22 |
1.06 |
1.00 |
1.06 |
1.00 |
polygamma |
16.70 |
1.42 |
6.56 |
1.00 |
7.49 |
1.05 |
sph_bessel |
2.36 |
1.24 |
3.31 |
1.41 |
2.12 |
1.00 |
sph_neumann |
3.40 |
1.21 |
3.59 |
1.21 |
3.14 |
1.00 |
tgamma |
4.72 |
1.44 |
5.70 |
1.05 |
2.29 |
1.00 |
tgamma (incomplete) |
3.28 |
1.13 |
3.88 |
1.14 |
2.21 |
1.00 |
trigamma |
2.08 |
1.00 |
4.00 |
1.50 |
2.00 |
1.08 |
zeta |
4.21 |
1.00 |
5.77 |
1.20 |
2.98 |
1.08 |