Re: [Numpy-discussion] numpy.concatenate slower than slice copying

2010-08-19 Thread Francesc Alted
2010/8/18, Zbyszek Szmek : > thank you for your detailed answer. It seems that memcpy which should always > be faster then memmove is sometimes slower! What happens is that > using the slice assignment calls memmove() which calls > _wordcopy_fwd_aligned() [1] > which is apparently faster than memcp

Re: [Numpy-discussion] numpy.concatenate slower than slice copying

2010-08-18 Thread Zbyszek Szmek
On Wed, Aug 18, 2010 at 02:06:51AM +0100, Francesc Alted wrote: > Hey Zbyszek, > > 2010/8/17, Zbyszek Szmek : > > Hi, > > this is a problem which came up when trying to replace a hand-written > > array concatenation with a call to numpy.vstack: > > for some array sizes, > > > >numpy.vstack(dat

Re: [Numpy-discussion] numpy.concatenate slower than slice copying

2010-08-17 Thread Francesc Alted
Hey Zbyszek, 2010/8/17, Zbyszek Szmek : > Hi, > this is a problem which came up when trying to replace a hand-written > array concatenation with a call to numpy.vstack: > for some array sizes, > >numpy.vstack(data) > > runs > 20% longer than a loop like > >alldata = numpy.empty((tlen, dim)

Re: [Numpy-discussion] numpy.concatenate slower than slice copying

2010-08-17 Thread Chris Colbert
Yes, concatenate is doing other work under the covers. In short, in supports concatenating a list of arbitrary python sequences into an array and does checking on each element of the tuple to ensure it is valid to concatenate. On Tue, Aug 17, 2010 at 9:03 AM, Zbyszek Szmek wrote: > Hi, > this is

[Numpy-discussion] numpy.concatenate slower than slice copying

2010-08-17 Thread Zbyszek Szmek
Hi, this is a problem which came up when trying to replace a hand-written array concatenation with a call to numpy.vstack: for some array sizes, numpy.vstack(data) runs > 20% longer than a loop like alldata = numpy.empty((tlen, dim)) for x in data: step = x.shape[0] all