
On 12/20/2009 04:57 PM, Chris M. Thomasson wrote:
"Tim Blechmann" <tim@klingt.org> wrote in message news:4B2E4492.3050201@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 [1] http://tim.klingt.org/git?p=boost_lockfree.git;a=blob;f=boost/lockfree/ringb... -- tim@klingt.org http://tim.klingt.org You can play a shoestring if you're sincere John Coltrane