[Numpy-discussion] reading *big* inhomogenous text matrices *fast*?

Robert Kern robert.kern@gmail....
Thu Aug 14 15:12:12 CDT 2008


On Thu, Aug 14, 2008 at 11:51, Christopher Barker <Chris.Barker@noaa.gov> wrote:
>
> One other potential downside of using python lists to accumulate numbers
> is that you are storing python objects (python ints or floats, or...)
> rather than raw numbers, which has got to incur some memory overhead.
>
> How does array.array perform in this context?

Pretty well for 1D arrays, at least.

> It has an append() method,
> and one would hope it uses a similar memory allocation scheme.

It does.

> Also, does numpy convert array.array objects to numpy arrays more
> efficiently? It could, of course, but someone would have to have written
> the special case code.

It does. array.array() exposes the Python buffer interface.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco


More information about the Numpy-discussion mailing list