[Numpy-discussion] Array concatenation performance

Benjamin Root ben.root@ou....
Thu Jul 15 13:47:09 CDT 2010


On Thu, Jul 15, 2010 at 12:38 PM, Sturla Molden <sturla@molden.no> wrote:

> Sorry for the previous mispost.
>
> This thread remids me of something I've though about for a while: Would
> NumPy benefit from an np.ndarraylist subclass of np.ndarray, that has an
> O(1) amortized append like Python lists? (Other methods of Python lists
> (pop, extend) would be worth considering as well.) Or will we get the
> same performance by combining a Python list and ndarray?
>
>
Another idea that I always thought was interesting comes from the C++
Standard Library. The .reserve() function call for the vector class, which
would go ahead and allocate the specified length, but the array length is
not set to that.  It was useful in the case where you have a decent idea of
the expected size of the array, but you still have to grow the array
iteratively.  Don't know how well that would fit into this context, but I
thought I ought to mention that.

Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100715/aea5ac71/attachment-0001.html 


More information about the NumPy-Discussion mailing list