[zeromq-dev] LMAX/Distruptor code project

Steven McCoy steven.mccoy at miru.hk
Thu Oct 6 18:15:47 CEST 2011


On 6 October 2011 12:02, Francois Saint-Jacques <fsaintjacques at gmail.com>wrote:

> IMHO, considering the fact that zmq is already using pre-allocated
> arrays in yqueues and that it's a 1-producer/1-consumer scenario, I
> don't think you will get a performance boost by using the disruptor
> pattern.
>
>
The only low level details that are different would be cache line padding,
such that the following would probably help:

#define CACHE_LINE_SIZE  64

/* reader */
  chunk_t *begin_chunk;
  int begin_pos;

  char padding1__[ CACHE_LINE_SIZE - (sizeof(chunk_t*) + sizeof(int)) ];

/* writer */
  chunk_t *back_chunk;
  int back_pos;
  chunk_t *end_chunk;
  int end_pos;

  char padding2__[ CACHE_LINE_SIZE - (2 * (sizeof(chunk_t*) + sizeof(int)))
];

/* cached chunk */
  atomic_ptr_t<chunk_t> spare_chunk;

  char padding3__[ CACHE_LINE_SIZE - sizeof(atomic_ptr_t<chunk_t>) ];

Didn't Martin try this already?

-- 
Steve-o
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20111006/c6f8822f/attachment.htm>


More information about the zeromq-dev mailing list