Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2006-12-15 17:17:38


Felipe Magno de Almeida wrote:
> On 12/15/06, Gennadiy Rozental <gennadiy.rozental_at_[hidden]> wrote:
>> [snipped]
>
>
>>>> Let's say you have record with 10 optional elements. tuple based solution
>>>> will end up compiling in anything from 1 to 10! different versions of the
>>>> same function, while offline version will be only one. Also in case if
>>>> you
>>>> always want output in the same 10 column format I dont see easy way to
>>>> implement it using tuples.
>>> We can take an arbitrary Fusion tuple and iterate it. Why should we be
>>> limited to a fixed number of elements?!
>>>
>>> Also, only the templates that really get instantiated end up in the binary
>> So if I have 100 different calls to the output function I will endup with
>> 100 different instantiations instantiation, right? And even in case of
>> inlining my code size would be 100 times more?
>
> I believe that most tuple functions when inlined should occuppy almost
> the same as a function call, so I dont belive your estimative would be
> correct. With register allocation playing right, there would be less,
> or none, need to save registers and the results being used directly
> too, the whole using function could be even smaller when using the
> inlined one.

Fusion has some perf tests for that. They are contained in
libs/fusion/example/performance. With good compilers like
VC++ and Intel, the abstraction penalty is zero. In other
words, there is zero overhead. You can see that by looking
at the assembler code. Go check it out!

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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