reading file contents to an array (newbie)
dd55 at cornell.edu
Fri Jul 9 23:12:16 CEST 2004
> If mmap returned something you could iterate over, you
> could probably shave a second off (I shaved 3 seconds of your example
> with this, and your example shaved 11 seconds of the original---on my
> machine, with my data, and my wife asking for the computer).
mmap turned out to work really well for me. I cut the time down again by
writing to a buffer 100 rows long, and appending when the buffer fills.
Especially when an array is big, it costs a lot of time to reallocate
the memory required to grow an array.
More information about the Python-list