...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Under boost-path/libs/math/reporting/performance you will find some reasonable comprehensive performance test applications for this library.
In order to generate the tables you will have seen in this documentation (or
others for your specific compiler) you need to invoke bjam
in this directory, using a C++11 capable compiler. Note that results extend/overwrite
whatever is already present in boost-path/libs/math/reporting/performance/doc/performance_tables.qbk,
you may want to delete this file before you begin so as to make a fresh start
for your particular system.
The programs produce results in Boost's Quickbook format which is not terribly
human readable. If you configure your user-config.jam to be able to build Docbook
documentation, then you will also get a full summary of all the data in HTML
format in boost-path/libs/math/reporting/performance/html/index.html.
Assuming you're on a 'nix-like platform the procedure to do this is to first
install the xsltproc
, Docbook DTD
,
and Bookbook XSL
packages. Then:
using xsltproc
;
to the end of the file (note the
space surrounding each token, including the final ";", this is
important!) This assumes that xsltproc
is in your path.
using boostbook
: path-to-xsl-stylesheets :
path-to-dtd
;
to the end of the file. The path-to-dtd
should point to version 4.2.x of the Docbook DTD, while path-to-xsl-stylesheets
should point to the folder
containing the latest XSLT stylesheets. Both paths should use all forward
slashes even on Windows.
At this point you should be able to run the tests and generate the HTML summary, if GSL, RMath or libstdc++ are present in the compilers path they will be automatically tested. For DCDFLIB you will need to place the C source in boost-path/libs/math/reporting/performance/third_party/dcdflib.
If you want to compare multiple compilers, or multiple options for one compiler,
then you will need to invoke bjam
multiple times, once for each compiler. Note that in order to test multiple
configurations of the same compiler, each has to be given a unique name in
the test program, otherwise they all edit the same table cells. Suppose you
want to test GCC with and without the -ffast-math option, in this case bjam
would be invoked first as:
bjam toolset=gcc -a cxxflags=-std=gnu++11
Which would run the tests using default optimization options (-O3), we can then run again using -ffast-math:
bjam toolset=gcc -a cxxflags='-std=gnu++11 -ffast-math' define=COMPILER_NAME='"GCC with -ffast-math"'
In the command line above, the -a flag forces a full rebuild, and the preprocessor define COMPILER_NAME needs to be set to a string literal describing the compiler configuration, hence the double quotes - one for the command line, one for the compiler.