Re: [Numpy-discussion] Array concatenation performance

2010-07-16 Thread Christopher Barker
Sturla Molden wrote: > Christopher Barker skrev: >> However, Python lists hold python objects, so it's bit inefficient, at >> least in terms of memory use. >> > I guess that is mainly in terms of memory use, as the Python (scalar) > objects must be created for the call to append. np.array([]) can

Re: [Numpy-discussion] Array concatenation performance

2010-07-16 Thread Sturla Molden
Christopher Barker skrev: > > However, Python lists hold python objects, so it's bit inefficient, at > least in terms of memory use. > I guess that is mainly in terms of memory use, as the Python (scalar) objects must be created for the call to append. np.array([]) can also be inefficient, as An

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Anne Archibald
On 15 July 2010 13:38, Sturla Molden 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 l

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Benjamin Root
On Thu, Jul 15, 2010 at 12:38 PM, Sturla Molden 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

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Sturla Molden
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 we

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Sturla Molden
Den 15.07.2010 15:41, skrev Skipper Seabold: > On Thu, Jul 15, 2010 at 5:54 AM, John Porter wrote: > >> Has anyone got any advice about array creation. I've been using numpy >> for a long time and have just noticed something unexpected about array >> concatenation. >> >> It seems that using nu

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Skipper Seabold
On Thu, Jul 15, 2010 at 12:23 PM, John Porter wrote: > ok - except that vstack doesn't seem to work for 2d arrays (without a > reshape) which is what I'm actually after. > Ah, then you might want hstack. There is also a column_stack and row_stack if you need to go that route. > The difference b

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread John Porter
ok - except that vstack doesn't seem to work for 2d arrays (without a reshape) which is what I'm actually after. The difference between the numpy.concatenate version and numpy.array is fairly impressive though, I get a factor of > 50x. It would be nice to know why. On Thu, Jul 15, 2010 at 4:15 PM

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Skipper Seabold
On Thu, Jul 15, 2010 at 11:05 AM, John Porter wrote: > You're right - I screwed up the timing for the one that works... > It does seem to be faster. > > I've always just built arrays using nx.array([]) in the past though > and was surprised > that it performs so badly. > > > On Thu, Jul 15, 2010 a

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Fabrice Silva
Le jeudi 15 juillet 2010 à 16:05 +0100, John Porter a écrit : > You're right - I screwed up the timing for the one that works... > It does seem to be faster. > > I've always just built arrays using nx.array([]) in the past though > and was surprised that it performs so badly. Can anyone provide a

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread John Porter
You're right - I screwed up the timing for the one that works... It does seem to be faster. I've always just built arrays using nx.array([]) in the past though and was surprised that it performs so badly. On Thu, Jul 15, 2010 at 2:41 PM, Skipper Seabold wrote: > On Thu, Jul 15, 2010 at 5:54 AM,

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Skipper Seabold
On Thu, Jul 15, 2010 at 5:54 AM, John Porter wrote: > Has anyone got any advice about array creation. I've been using numpy > for a long time and have just noticed something unexpected about array > concatenation. > > It seems that using numpy.array([a,b,c]) is around 20 times slower > than creati

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] Array concatenation performance

2010-07-15 Thread John Porter
Has anyone got any advice about array creation. I've been using numpy for a long time and have just noticed something unexpected about array concatenation. It seems that using numpy.array([a,b,c]) is around 20 times slower than creating an empty array and adding the individual elements. Other thi