There are a small number of performance tuning options that are determined
by configuration macros. These should be set in boost/math/tools/user.hpp;
or else reported to the Boost-development mailing list so that the appropriate
option for a given compiler and OS platform can be set automatically in our
configuration setup.
The values to which BOOST_MATH_POLY_METHOD
and BOOST_MATH_RATIONAL_METHOD
may be set are as follows:
To determine which of these options is best for your particular compiler/platform
build the performance test application with your usual release settings,
and run the program with the --tune command line option.
In practice the difference between methods is rather small at present, as
the following table shows. However, parallelisation /vectorisation is likely
to become more important in the future: quite likely the methods currently
supported will need to be supplemented or replaced by ones more suited to
highly vectorisable processors in the future.
Table?49.?A Comparison of Polynomial Evaluation Methods
Compiler/platform
|
Method 0
|
Method 1
|
Method 2
|
Method 3
|
Microsoft C++ 8.0, Polynomial evaluation
|
1.34
(1.161e-007s)
|
1.13
(9.777e-008s)
|
1.07
(9.289e-008s)
|
1.00
(8.678e-008s)
|
Microsoft C++ 8.0, Rational evaluation
|
1.00
(1.443e-007s)
|
1.03
(1.492e-007s)
|
1.20
(1.736e-007s)
|
1.07
(1.540e-007s)
|
Intel C++ 10.0 (Windows), Polynomial evaluation
|
1.03
(7.702e-008s)
|
1.03
(7.702e-008s)
|
1.00
(7.446e-008s)
|
1.03
(7.690e-008s)
|
Intel C++ 10.0 (Windows), Rational evaluation
|
1.00
(1.245e-007s)
|
1.00
(1.245e-007s)
|
1.18
(1.465e-007s)
|
1.06
(1.318e-007s)
|
GNU G++ 4.2 (Linux), Polynomial evaluation
|
1.61
(1.220e-007s)
|
1.68
(1.269e-007s)
|
1.23
(9.275e-008s)
|
1.00
(7.566e-008s)
|
GNU G++ 4.2 (Linux), Rational evaluation
|
1.26
(1.660e-007s)
|
1.33
(1.758e-007s)
|
1.00
(1.318e-007s)
|
1.15
(1.513e-007s)
|
Intel C++ 10.0 (Linux), Polynomial evaluation
|
1.15
(9.154e-008s)
|
1.15
(9.154e-008s)
|
1.00
(7.934e-008s)
|
1.00
(7.934e-008s)
|
Intel C++ 10.0 (Linux), Rational evaluation
|
1.00
(1.245e-007s)
|
1.00
(1.245e-007s)
|
1.35
(1.684e-007s)
|
1.04
(1.294e-007s)
|
There is one final performance tuning option that is available as a compile
time policy. Normally when evaluating
functions at double precision,
these are actually evaluated at long
double precision internally: this
helps to ensure that as close to full double
precision as possible is achieved, but may slow down execution in some environments.
The defaults for this policy can be changed by defining
the macro BOOST_MATH_PROMOTE_DOUBLE_POLICY
to false , or by
specifying a specific policy when calling the special functions or
distributions. See also the policy
tutorial.
Table?50.?Performance Comparison with and Without Internal
Promotion to long double
|