[Numpy-discussion] fast constructor for arrays from byte data (unpickling?)

Hung Jung Lu hungjunglu at yahoo.com
Tue Aug 7 14:50:04 CDT 2001


Hi,

Arrays have a method called tostring() which generates
the binary data. Is there an inverse function to that?
That is, generating an array from the binary data
string?

For large matrices, pickling/unpickling is a bit too
much overhead (data stored as ASCII character strings
instead of binary data strings.) I know, I am talking
about a factor 4 here. But there is a big difference
between 1 minute loading time and 4 minute loading
time.

I would imagine this is a very common problem/request
for people working with large matrices. And I am sure
hacking the C code to provide another fast constructor
for arrays from binary strings won't be too hard. The
questions is: has anyone already tried it? Is it
already there?

(For the kludge masters: one kludge is of course to
store the binary data on disk, then use cStringIO to
build the pickled file and then unpickle from the
cStringIO. Speed is probably OK since the pickled file
lives on RAM. But that's a kludge. :) )

regards,

Hung Jung


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/




More information about the Numpy-discussion mailing list