Boost logo

Boost :

Subject: Re: [boost] [fusion] improving compile times
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2009-06-02 09:57:43


Eric Niebler 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. 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.
That's not necessarily a good benchmark, especially if you replace it by
preprocessor metaprogramming which leads to more non-template code. GCC
is extremely slow at instantiating templates, but this is not
necessarily true for other compilers - I believe, for example, that
Clang will be faster at instantiating templates than parsing raw code.
(No benchmarks - but I know the code.)

So really, before comitting something, you should measure its real-time
impact, and measure it at least in two compilers.

Sebastian


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