[zeromq-dev] inproc: passing pointer VS zero-copy VS regular send?

Pieter Hintjens ph at imatix.com
Sun May 12 18:54:32 CEST 2013

Hi Oleg,

Some general advice:

- don't optimize code until you need to, measure before and after.
- zero copy is not useful on small messages
- don't pass pointers around
- read the Guide and learn by making simple designs first
- again, don't optimize or try to make designs faster until you really need to


On Sat, May 11, 2013 at 4:27 AM, Oleg Vazhnev <ovazhnev at gmail.com> wrote:
> Hi,
> In my financial software I receive quotes from stock exchange. Each
> update is something like that:
> struct OrderUpdate {
>      uint32_t instrumentId;
>      uint32_t MDEntryID;
>      uint32_t MDUpdateAction;      // 0 - New 1 - Change 2 -Delete
>      double /*decimal*/ MDEntryPx;
>      double /*decimal*/ MDEntrySize;
>      uint32_t RptSeq;
>      uint32_t MDEntryTime;
>      uint32_t OrigTime;
>      char MDEntryType;
> };
> I do not instatiate this structure at runtime, instead i pre-allocate
> and reuse/reconfigure it (currently I actually have only ONE instance of
> this structure and reconfigure it every time).
> I'm going to use "inproc" binding.
> I need to pass this structures from c++ to c# (later c++ to c++ cause
> will move to Linux).
> So far it seems I have these options:
>   - pass pointer (asynchronous? likely need to create ring-buffer of
> strucutres)
>   - pass structure itself but use "zero-copy" (asynchronous? need
> ring-buffer?)
>   - use regular "send" (if it's enough to have one instance of structure
> then? at what point I can reuse it?)
> As i'm absolutely novice in ZeroMQ it's hard for me to understand all
> pros and cons of each approach, so looking for help from experts. I
> guess that my problem is pretty general and so some "recommended"
> solution exist.
> Also what's better to use in my situation PUB-SUB or PUSH-PULL?
> Thanks!
>   Oleg
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

More information about the zeromq-dev mailing list