|
Boost : |
From: Joel de Guzman (joel_at_[hidden])
Date: 2006-12-15 17:22:34
Gennadiy Rozental wrote:
> "Felipe Magno de Almeida" <felipe.m.almeida_at_[hidden]> wrote in message
> news:a2b17b60612151137o20340d10i5c2a2f18e293ca5c_at_mail.gmail.com...
>> 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.
>
> It's possible. Still there code size will be significantly bigger in
> comparison with offline implementation, right?
No, there is zero overhead. See my other post. Fusion vector, for
example is as fast as a struct. Why? because it *IS* as struct.
So, accesses to its members, for example is as fast as:
s.member
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