[Numpy-discussion] Faster

Christopher Barker Chris.Barker at noaa.gov
Mon May 5 00:22:32 EDT 2008


Keith Goodman wrote:
> Why is it so slow to copy data

I think the speed of copying data is highly dependent on what's in 
cache, but in any case, much faster than:

> create an empty array?

creating a new array requires a memory allocation, which is apparently a 
bunch slower than moving data around -- not that I have any idea why!

I note about this last "destructive_cut" method -- it keeps using a view 
to the original array's data block. That may not be an issue at all, but 
it means that if you are starting with a big array, and removing a bit 
at time, you'll maintain that big 'ol chunk of data in memory, even when 
your working set is small. Also the resulting arrays aren't contiguous, 
which again, may or may not matter.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception



More information about the NumPy-Discussion mailing list