...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 16.7. Compiler Comparison on Windows x64
Function |
Microsoft Visual C++ version 14.0 |
Intel C++ C++0x mode version 1500 |
GNU C++ version 4.9.2 |
GNU C++ version 4.9.2 |
---|---|---|---|---|
assoc_laguerre |
1.09 |
1.00 |
1.29 |
1.09 |
assoc_legendre |
1.64 |
1.00 |
1.84 |
1.15 |
beta |
1.97 |
1.00 |
3.64 |
2.01 |
beta (incomplete) |
1.41 |
1.00 |
3.42 |
1.74 |
cbrt |
3.86 |
1.00 |
3.43 |
3.29 |
cyl_bessel_i |
1.12 |
1.00 |
2.90 |
1.23 |
cyl_bessel_i (integer order) |
1.30 |
1.00 |
3.29 |
1.31 |
cyl_bessel_j |
1.38 |
1.00 |
2.10 |
1.32 |
cyl_bessel_j (integer order) |
1.33 |
1.00 |
2.23 |
1.19 |
cyl_bessel_k |
1.18 |
1.00 |
10.67 |
1.14 |
cyl_bessel_k (integer order) |
1.26 |
1.00 |
10.84 |
1.14 |
cyl_neumann |
17.34 |
15.24 |
2.09 |
1.00 |
cyl_neumann (integer order) |
1.21 |
1.00 |
2.03 |
1.29 |
digamma |
1.33 |
1.00 |
3.76 |
2.19 |
ellint_1 |
2.23 |
1.00 |
2.25 |
1.45 |
ellint_1 (complete) |
1.78 |
1.00 |
2.47 |
1.53 |
ellint_2 |
1.91 |
1.00 |
2.35 |
1.66 |
ellint_2 (complete) |
1.94 |
1.00 |
2.09 |
1.00 |
ellint_3 |
2.12 |
1.00 |
3.04 |
1.63 |
ellint_3 (complete) |
1.97 |
1.00 |
3.21 |
1.65 |
ellint_rc |
1.47 |
1.00 |
2.66 |
1.53 |
ellint_rd |
1.62 |
1.00 |
1.85 |
1.34 |
ellint_rf |
1.47 |
1.00 |
2.33 |
1.40 |
ellint_rj |
2.00 |
1.00 |
2.62 |
1.45 |
erf |
1.55 |
1.00 |
3.36 |
2.36 |
erfc |
1.47 |
1.00 |
3.24 |
2.06 |
expint |
1.00 |
1.00 |
3.18 |
2.21 |
expint (En) |
1.12 |
1.00 |
2.14 |
1.50 |
expm1 |
1.00 |
1.00 |
3.75 |
3.00 |
gamma_p |
1.26 |
1.00 |
2.78 |
1.70 |
gamma_p_inv |
1.26 |
1.00 |
2.31 |
1.89 |
gamma_q |
1.27 |
1.00 |
2.78 |
1.60 |
gamma_q_inv |
1.36 |
1.00 |
2.38 |
1.97 |
ibeta |
1.27 |
1.00 |
3.13 |
1.72 |
ibeta_inv |
1.32 |
1.00 |
2.92 |
1.79 |
ibetac |
1.51 |
1.00 |
3.27 |
1.76 |
ibetac_inv |
1.26 |
1.00 |
2.66 |
1.69 |
jacobi_cn |
1.20 |
1.00 |
3.67 |
2.15 |
jacobi_dn |
1.17 |
1.00 |
3.19 |
1.84 |
jacobi_sn |
1.31 |
1.00 |
3.17 |
1.81 |
laguerre |
1.00 |
1.00 |
1.17 |
1.10 |
legendre |
1.05 |
1.15 |
1.24 |
1.00 |
legendre Q |
1.00 |
1.12 |
1.23 |
1.05 |
lgamma |
1.28 |
1.00 |
3.46 |
2.03 |
log1p |
1.10 |
1.00 |
3.00 |
1.60 |
polygamma |
1.15 |
1.00 |
1.12 |
2.24 |
sph_bessel |
1.18 |
1.00 |
1.61 |
1.13 |
sph_neumann |
1.23 |
1.00 |
2.28 |
1.12 |
tgamma |
1.70 |
1.00 |
3.33 |
2.14 |
tgamma (incomplete) |
1.13 |
1.00 |
2.53 |
1.81 |
trigamma |
2.12 |
1.00 |
2.88 |
1.76 |
zeta |
1.81 |
1.00 |
3.93 |
2.60 |
Table 16.8. Compiler Comparison on linux
Function |
GNU C++ version 5.1.0 |
GNU C++ version 5.1.0 |
Intel C++ C++0x mode version 1500 |
Intel C++ C++0x mode version 1500 |
Clang version 3.7.0 (trunk 236512) |
Clang version 3.7.0 (trunk 236512) |
---|---|---|---|---|---|---|
assoc_laguerre |
1.23 |
1.05 |
1.21 |
1.00 |
1.23 |
1.25 |
assoc_legendre |
2.84 |
1.14 |
1.92 |
1.00 |
2.98 |
1.18 |
beta |
8.62 |
1.86 |
5.99 |
1.00 |
9.21 |
1.86 |
beta (incomplete) |
4.74 |
1.51 |
3.36 |
1.00 |
4.97 |
1.51 |
cbrt |
2.56 |
1.06 |
2.31 |
1.12 |
2.81 |
1.00 |
cyl_bessel_i |
4.41 |
1.24 |
3.72 |
1.00 |
4.76 |
1.28 |
cyl_bessel_i (integer order) |
3.62 |
1.11 |
3.38 |
1.00 |
4.13 |
1.17 |
cyl_bessel_j |
3.26 |
1.21 |
2.94 |
1.00 |
3.55 |
1.33 |
cyl_bessel_j (integer order) |
3.49 |
1.31 |
2.92 |
1.00 |
3.80 |
1.30 |
cyl_bessel_k |
7.29 |
1.06 |
7.21 |
1.00 |
7.96 |
1.22 |
cyl_bessel_k (integer order) |
10.29 |
1.00 |
11.07 |
1.01 |
15.39 |
1.12 |
cyl_neumann |
2.90 |
1.17 |
2.74 |
1.00 |
3.51 |
1.21 |
cyl_neumann (integer order) |
2.19 |
1.06 |
2.29 |
1.00 |
2.93 |
1.11 |
digamma |
2.79 |
1.50 |
2.21 |
1.00 |
2.92 |
1.46 |
ellint_1 |
2.03 |
1.04 |
2.19 |
1.00 |
4.26 |
1.01 |
ellint_1 (complete) |
2.52 |
1.19 |
1.95 |
1.00 |
2.29 |
1.29 |
ellint_2 |
2.74 |
1.19 |
3.30 |
1.00 |
4.79 |
1.16 |
ellint_2 (complete) |
2.07 |
1.19 |
2.22 |
1.00 |
2.00 |
1.19 |
ellint_3 |
3.42 |
1.26 |
3.40 |
1.00 |
4.84 |
1.22 |
ellint_3 (complete) |
3.21 |
1.29 |
3.07 |
1.00 |
4.12 |
1.27 |
ellint_rc |
2.34 |
1.44 |
1.59 |
1.00 |
2.38 |
1.25 |
ellint_rd |
2.58 |
1.19 |
2.15 |
1.00 |
3.72 |
1.17 |
ellint_rf |
2.24 |
1.51 |
1.63 |
1.00 |
2.51 |
1.37 |
ellint_rj |
3.03 |
1.30 |
2.95 |
1.00 |
3.89 |
1.21 |
erf |
2.77 |
1.00 |
2.38 |
1.00 |
2.77 |
1.00 |
erfc |
2.79 |
1.00 |
2.37 |
1.00 |
2.79 |
1.00 |
expint |
2.87 |
1.10 |
2.26 |
1.00 |
2.71 |
1.10 |
expint (En) |
2.20 |
1.20 |
1.95 |
1.00 |
2.39 |
1.39 |
expm1 |
1.50 |
1.25 |
1.50 |
1.00 |
1.12 |
1.25 |
gamma_p |
3.13 |
1.30 |
2.54 |
1.00 |
3.26 |
1.30 |
gamma_p_inv |
3.11 |
1.42 |
2.29 |
1.00 |
3.13 |
1.41 |
gamma_q |
3.43 |
1.38 |
2.66 |
1.00 |
3.44 |
1.36 |
gamma_q_inv |
4.93 |
1.92 |
2.85 |
1.00 |
4.87 |
1.94 |
ibeta |
4.52 |
1.61 |
3.33 |
1.00 |
4.75 |
1.56 |
ibeta_inv |
3.57 |
1.43 |
2.92 |
1.00 |
3.82 |
1.43 |
ibetac |
4.62 |
1.64 |
3.30 |
1.00 |
4.83 |
1.59 |
ibetac_inv |
3.58 |
1.45 |
2.92 |
1.00 |
3.85 |
1.42 |
jacobi_cn |
3.73 |
1.33 |
2.76 |
1.00 |
3.85 |
1.36 |
jacobi_dn |
3.46 |
1.25 |
2.74 |
1.00 |
3.58 |
1.27 |
jacobi_sn |
3.75 |
1.34 |
2.55 |
1.00 |
3.84 |
1.38 |
laguerre |
1.21 |
1.03 |
1.20 |
1.00 |
1.18 |
1.28 |
legendre |
1.16 |
1.00 |
1.36 |
1.14 |
1.15 |
1.08 |
legendre Q |
1.21 |
1.00 |
1.39 |
1.19 |
1.21 |
1.03 |
lgamma |
3.70 |
1.68 |
2.76 |
1.00 |
3.95 |
1.67 |
log1p |
1.00 |
1.00 |
1.18 |
1.09 |
1.00 |
1.00 |
polygamma |
10.22 |
2.64 |
5.34 |
1.00 |
10.25 |
2.65 |
sph_bessel |
1.81 |
1.05 |
1.69 |
1.00 |
1.92 |
1.05 |
sph_neumann |
2.16 |
1.01 |
2.25 |
1.00 |
2.42 |
1.04 |
tgamma |
6.28 |
1.75 |
3.83 |
1.00 |
6.68 |
1.77 |
tgamma (incomplete) |
3.34 |
1.42 |
2.39 |
1.00 |
3.51 |
1.40 |
trigamma |
1.58 |
1.00 |
1.74 |
1.05 |
1.89 |
1.11 |
zeta |
4.35 |
1.61 |
2.98 |
1.00 |
4.11 |
1.54 |