[Numpy-discussion] Array concatenation performance
Thu Jul 15 13:47:09 CDT 2010
On Thu, Jul 15, 2010 at 12:38 PM, Sturla Molden <email@example.com> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion