Subject: Re: [boost] [lockfree::fifo] Review
From: Chris M. Thomasson (cristom_at_[hidden])
Date: 2009-12-20 10:57:29
"Tim Blechmann" <tim_at_[hidden]> wrote in message
> > 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:
void* m_buffer; // multiple of a cache-line
Then ensure that `ringbuffer' structs are actually aligned on a cache line
unsigned char buffer[sizeof(struct ringbuffer) + 63];
struct ringbuffer* rb = ALIGN(buffer, 64);
Now I know for sure that `rb' is isolated and won't experience/cause false
sharing with other parts of the application.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk