Boost logo

Boost :

From: Jaap Suter (J.Suter_at_[hidden])
Date: 2003-03-13 01:46:30


Hello,

I promised to get back with some timings for the compiletime debug and
release discussion.

I've tested it with my own projets which makes heavy use of
BOOST_STATIC_ASSERTS in many places, particularly in the meta equivalent of
tight inner-loops. Here are some examples of static asserts I'm using:

BOOST_STATIC_ASSERT( (mpl::greater_equal< IndexLhs, mpl::integral_c<
typename IndexLhs::value_type, 0 > >::type::value) );
BOOST_STATIC_ASSERT( (mpl::greater_equal< IndexRhs, mpl::integral_c<
typename IndexRhs::value_type, 0 > >::type::value) );
BOOST_STATIC_ASSERT( (mpl::less< IndexLhs, typename
Algebra::algebra_dimension >::type::value) );
BOOST_STATIC_ASSERT( (mpl::less< IndexRhs, typename
Algebra::algebra_dimension >::type::value) );
BOOST_STATIC_ASSERT( (mpl::not_< typename mpl::empty< GradeListRhs >::type
>::type::value) );
BOOST_STATIC_ASSERT( (mpl::not_< typename mpl::empty< GradeListLhs >::type
>::type::value) );

I would think that especially the last two might be heavy (depending on the
type of the GradeList, vector or list).

Here are the results for the different configurations (minutes:seconds):

GCC - Runtime Release - Compiletime Debug - 1:43
GCC - Runtime Release - Compiletime Release - 1:45

GCC - Runtime Debug - Compiletime Debug - 1:08
GCC - Runtime Debug - Compiletime Release - 1:05

Intel - Runtime Release - Compiletime Debug - 2:27
Intel - Runtime Release - Compiletime Release - 2:45

Intel - Runtime Debug - Compiletime Release - 2:04
Intel - Runtime Debug - Compiletime Debug - 2:07

The only noticable difference can be seen in the Intel Runtime Release
version, however there the Compiletime Debug version is actually faster. I
don't think this is very significant though, it could be just my computer
deciding to do something else for a while during the compilation (I did
close all other applications though). The other tree results can be
considered the same.

I am fairly confident that somebody could come up with an example where a
compiletime release and debug version make a difference. However, in my
situation this is clearly not the case. I do, however, feel that a
distinction between compiletime debug and release might eventually become
useful in the future. For now however;

Recommendation:

    At this point it is _not_ necessary to change the BOOST_STATIC_ASSERT
macro to allow both a release and debug version.

Note:

    In hindsight it seems my assertions aren't that particularly heavy. I
guess I over-estimated the cost of a single meta-function call. It seems
recursion is more of a killer here.

Regards,

Jaap Suter


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk