[zeromq-dev] Python message passing

Erich Heine sophacles at gmail.com
Fri Apr 24 00:49:32 CEST 2009

On Thu, Apr 23, 2009 at 5:21 PM, kfadnis <kfadnis at gmail.com> wrote:

> About serialization, yes that would be nice. But I am thinking message size
> would be a factor, no?

I think it depends on the serialization technique. With Pickle, it may
become so. with other binary methods, maybe not so much. I think that
googles thing, protocol buffers, keeps overhead to a minimum. Of course if
your messages are really simple, a proprietary struct.pack would probably be

>  As for wrapping zero-mq in swig, it should work. Alternately I have been
>> looking at and learning boost to wrap zeromq, as it seems nicer for doing
>> C++ wrappings.  I'm not sure however that swig will provide any speedups, as
>> the wrapper is simple, and swig must go through a translation layer instead
>> of a direct call.
> re SWIG, I haven't used Boost to wrap C++ but I have read it has its
> advantages. SWIG itself would have a translation layer but wouldn't it save
> the memcpy() call in the pyZMQ_send() ?

I believe that the memcpy or a similar mechanism would be required or a
bunch of accounting to track the PyString object and prevent its garbage
collection. I will need to look into how other C* I/O backends that use
async I/O do it to be sure.

I also think that the swig overhead would be comparable to memcpy at best.
More likely the translation through swig would be more expensive. Of course
it is a guess on my part and only a good set of measurements will show it
true or not.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20090423/bd71f01c/attachment.htm>

More information about the zeromq-dev mailing list