[zeromq-dev] Python message passing

Erich Heine sophacles at gmail.com
Thu Apr 23 23:55:15 CEST 2009


I've been using the struct module with zeromq to get around the "string
problem".  More generally though, zeromq doesn't seem to provide a
serialization solution which is really what you need when converting high
level language constructs to a message on the wire. (the Pickle family of
modules would work nicely too)

There should however be some sort of hook to allow for low level
serialization techniques e.g. easy combination with the google thing (whose
name I always forget).

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.

A final thought on this situation: if the string conversion is really what
is causing the difference between acceptable and unacceptable timing in
python, by which i mean  there is no good algorithmic or "simple dirty
trick" method to bring the speed to the acceptable side,  then I've found
that a compiled solution is usually the way to go. It may just be your main
loop, or your most computationally heavy functions, but it can make all the
difference.

Regards,
Erich

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

> Hi Guys,
>
> I was peeking at the C++ wrapper for python (pyzmq.cpp). And the
> pyZMQ_send() method casts the message as a string, am i correct in reading
> this ?
> I ask because i was trying to pass a double and couldn't. This adds an
> extra call to the str to something conversion for me to convert back.
>
> Also, I was wondering if it is possible to wrap the C++ library using
> SWIG, as this possibly reduces the overhead of the calls increasing
> effciency ?
>
> I might try this if anyone thinks this has a decent shot of working.
>
> Thanks
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20090423/bf5139a4/attachment.htm>


More information about the zeromq-dev mailing list