Boost logo

Boost :

Subject: Re: [boost] [fusion] improving compile times
From: David Abrahams (dave_at_[hidden])
Date: 2009-06-03 12:21:04


on Tue Jun 02 2009, Eric Niebler <eric-AT-boostpro.com> wrote:

> Larry Evans wrote:
>> On 06/01/09 20:26, Eric Niebler wrote:
>>> I'm attaching a simple patch to vector_n_chooser.hpp that replaces some template
>>> metaprogramming with preprocessor metaprogramming in the interest of improving
>>> compile times. I found this hotspot through profiling,
>> [snip]
>> Eric,
>>
>> Could you post your benchmark code that showed the improvement in
>> compile speed? I'd like to eventually try it with a variadic template
>> compiler version of fusion vector.
>
> I confess that I'm not actually benchmarking compile speed; rather, I'm benchmarking
> the number of template instantiations as reported by Steven's template
> profiler.

Watch out: PP metaprogramming can slow down compilation, too. I had to
get Paul Mensonides to help me figure out how to make it efficient in
Boost.Python, because what I was doing caused noticeable drag.

> I'm profiling TMP-heavy code like some of Proto's and xpressive's
> tests and cherry-picking the worst offenders. The Fusion
> vector_n_chooser patch knocked off 100's of template instantiations,
> for instance.

Better make sure you're actually saving cycles, or you could be
obfuscating code for naught.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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