philipbergen/zero

use of zero-copy / track

Opened this issue · 1 comments

I see that you unconditionally use zero-copy and message tracking when you send messages, and only use the tracker as a sort of 'blocking' flag. I wouldn't really recommend taking this approach for a couple of reasons:

  1. zero-copy is actually slower than copying unless messages are large, thanks to the thread coordination involved in dealloc of zero copy messages.
  2. you rarely actually need to wait for zeromq to be done with a message (this misses some of the point of zmq). The main reason to track messages is to avoid memory corruption of arrays that you plan to change.

Good points, thanks! I'll see what I can change. Pull requests are always welcome!