binary input and memory address passing
Eric Carlson
ecarlson at coe.eng.ua.edu
Tue Dec 12 21:42:19 EST 2006
Hello,
I can open, read, and convert data to a numeric (double) array from a
binary file using
nc = #something given
nr = #something given
f_o=open('junk.bin','rb')
x=reshape(array('d',f_o.read()),(nr,nc))
Is there a way in python that gives better performance? These commands
take three to 4 times longer than loading the data into an array in (for
example) octave.
Also, is there a way to pass the address of a block of memory, and then
access the data located there (pass by reference and let the python
program know what data type to use)?
My situation: I have two programs that can not communicate directly, but
I can get memory addresses for any data in my programs. I currently save
to a file, then load the data from file into my other program. Clearly
it would be much faster if I could access the block of memory directly
rather than making a copy.
Any suggestions greatly appreciated.
Cheers,
Eric Carlson
More information about the Python-list
mailing list