|
Boost : |
Subject: Re: [boost] [lockfree::fifo] Review
From: Tim Blechmann (tim_at_[hidden])
Date: 2009-12-20 11:17:43
On 12/20/2009 04:57 PM, Chris M. Thomasson wrote:
> "Tim Blechmann" <tim_at_[hidden]> wrote in message
> news:4B2E4492.3050201_at_klingt.org...
>
>>> Well, IMO, it should perform better because the producer and consumer
>>> are
>>> not thrashing each other wrt the head and tail indexes.
>
>> the performance difference is almost the same.
>
> Interesting. Thanks for profiling it. Have you tried aligning everything on
> cache line boundaries? I would try to ensure that the buffer is aligned and
> padded along with the head and tail variables. For 64-byte cache line and
> 32-bit pointers you could do:
i am using [1] (from my topic/ringbuffer_chris branch):
static const int padding_size = BOOST_LOCKFREE_CACHELINE_BYTES -
sizeof(size_t);
cell m_buffer[max_size];
char padding1[padding_size];
size_t m_head; // = 0
char padding2[padding_size];
size_t m_tail; // = 0
cheers, tim
-- tim_at_[hidden] http://tim.klingt.org You can play a shoestring if you're sincere John Coltrane
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk