[zeromq-dev] Python message passing
kfadnis
kfadnis at gmail.com
Fri Apr 24 00:21:46 CEST 2009
On Thu, Apr 23, 2009 at 5:55 PM, Erich Heine <sophacles at gmail.com> wrote:
> 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)
Thanks! yes, the struct module sounds something I could use, i'll give it a
try.
>
> 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).
>
About serialization, yes that would be nice. But I am thinking message size
would be a factor, no?
> 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() ? But its a guess at this point.
> 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.
>
Yes thank you for that suggestion. I appreciate your response.
>
> 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/e06c2ddb/attachment.htm>
More information about the zeromq-dev
mailing list