Boost logo

Boost :

Subject: Re: [boost] [Booster] Or boost is useless for library developers
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2010-05-19 15:49:33


Stewart, Robert <Robert.Stewart <at> sig.com> writes:

>
> Artyom wrote:
> >
> > Heavy template code produces significantly lager code. So hiding
> > implementation actually reduces code size and reduces bloat.
>
> Ridiculous. Misuse of templates can do so, but I doubt
> you'll find (m)any examples in Boost. Templates
> expose more code to the compiler permitting otherwise
> impossible optimizations. Expression templates, for example,
> eliminate tremendous runtime code and overhead utterly impossible
> to do otherwise.

I do not think this is ridiculous. This is well known fact. Templates do lead to
the larger code size and larger compilation time. You can hardly argue with that.
The same time I agree that they lead to better performance in many cases. Not
always. I had number of real life scenarios where excessive inlining lead to
losing locality and eventually worse performance.

You always need to balance these two forces. If you get 0.5% performance
advantage, but required to add half an half an hour to the compilation, your
choice is pretty much clear, right?

An ability to define this boundary between what to put in headers and what to
offline correctly is important designer quality.

Gennadiy


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