|
Boost : |
Subject: Re: [boost] Proposal: Monotonic Containers
From: David Bergman (David.Bergman_at_[hidden])
Date: 2009-06-10 14:05:28
On Jun 10, 2009, at 1:58 PM, David Bergman wrote:
> On Jun 10, 2009, at 1:49 PM, David Bergman wrote:
>
>> On Jun 10, 2009, at 4:54 AM, Christian Schladetsch wrote:
>>
>>> Hi Artyom,
>>>
>>> You **must** return aligned pointers from allocators.
>>>
>>>
>>> boost::monotonic does not allocate.
>>
>> I wonder what that 'allocator' of yours is for then? ;-)
>>
>> Of course it allocates. And you fail to align the start address,
>> which makes certain use cases crash on certain platforms. On Intel,
>> it "just" gives the user a worse performance when misaligned. This
>> is not aligned (pun intended...) with your overall goal to give the
>> developer a high-performance tool. But do not take my word for it,
>> I ran a test with your container, the attached sample program and
>> got around 33.3 picoseconds on average to perform an increment on
>> an aligned long compared to 35.6 picoseconds for a misaligned long,
>> i.e., some 8% difference. Actually, I got a bit more with other
>> operations.
>
> In fact, the attached version is a very lenient one, since it does
> give proper alignment for a lot of iterations... I used prime number
> distributions in other samples. Nevertheless, this sample produced
> between 8% and 10% difference between the two cases. I can provide
> you with more information about the performance hit of using
> misaligned stuff if you want.
When packing the structures, such as with __attribute((__packed__))
for GCC, I got an almost 20% speed penalty on my Intel-based OS X
laptop, when using your non-aligning allocator.
/David
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk