object references/memory access

dlomsak dlomsak at gmail.com
Sun Jul 1 06:18:41 CEST 2007


Paul Rubin wrote:
> dlomsak <dlomsak at gmail.com> writes:
> > knowledge of the topic to help. If the above are not possible but you
> > have a really good idea for zipping large amounts of data from one
> > program to another, I'd like to hear it.
>
> One cheesy thing you might try is serializing with marshal rather than
> pickle.  It won't handle as many object types, and it's not guaranteed
> interoperable from one Python version to another, but it's potentially
> faster than pickle.  Of course for pickling I presume you're already
> using cPickle (written in C) instead of Pickle (written in Python).

Well, I was using the regular pickle at first but then I switched to
just using repr() / eval() because the resulting string doesn't have
all the extra 's1=' and all that so it cuts down on the amount of data
I have to send for large returns when you cut out all of that
formatting. The speed of the above method is pretty high even for
really large returns and it works fine for a list of dictionaries.

To the previous poster: I'll be looking into C shared memory like you
said. I have a feeling C will let me lay my hands on the things I want
and that Python probably will not. That's fine though because Python
is a wonderful language and I don't mind calling in tedious C to do
the real dirty jobs if that is what it takes.




More information about the Python-list mailing list