Re: [Numpy-discussion] Question about unaligned access

2015-07-07 Thread Todd
On Jul 6, 2015 6:21 PM, "Francesc Alted" wrote: > > 2015-07-06 18:04 GMT+02:00 Jaime Fernández del Río : >> >> On Mon, Jul 6, 2015 at 10:18 AM, Francesc Alted wrote: >>> >>> Hi, >>> >>> I have stumbled into this: >>> >>> In [62]: sa = np.fromiter(((i,i) for i in range(1000*1000)), dtype=[('f0', n

Re: [Numpy-discussion] Question about unaligned access

2015-07-06 Thread Julian Taylor
sorry for the 3 empty mails, my client bugged out... as a workaround you can align structured dtypes to avoid this issue: sa = np.fromiter(((i,i) for i in range(1000*1000)), dtype=np.dtype([('f0', np.int64), ('f1', np.int32)], align=True)) On 06.07.2015 18:21, Francesc Alted wrote: > 2015-07-06

Re: [Numpy-discussion] Question about unaligned access

2015-07-06 Thread Julian Taylor
On 06.07.2015 18:21, Francesc Alted wrote: > 2015-07-06 18:04 GMT+02:00 Jaime Fernández del Río >: > > On Mon, Jul 6, 2015 at 10:18 AM, Francesc Alted > wrote: > > Hi, > > I have stumbled into this: > > In [

Re: [Numpy-discussion] Question about unaligned access

2015-07-06 Thread Julian Taylor
On 06.07.2015 18:21, Francesc Alted wrote: > 2015-07-06 18:04 GMT+02:00 Jaime Fernández del Río >: > > On Mon, Jul 6, 2015 at 10:18 AM, Francesc Alted > wrote: > > Hi, > > I have stumbled into this: > > In [

Re: [Numpy-discussion] Question about unaligned access

2015-07-06 Thread Julian Taylor
On 06.07.2015 18:21, Francesc Alted wrote: > 2015-07-06 18:04 GMT+02:00 Jaime Fernández del Río >: > > On Mon, Jul 6, 2015 at 10:18 AM, Francesc Alted > wrote: > > Hi, > > I have stumbled into this: > > In [

Re: [Numpy-discussion] Question about unaligned access

2015-07-06 Thread Francesc Alted
2015-07-06 18:04 GMT+02:00 Jaime Fernández del Río : > On Mon, Jul 6, 2015 at 10:18 AM, Francesc Alted wrote: > >> Hi, >> >> I have stumbled into this: >> >> In [62]: sa = np.fromiter(((i,i) for i in range(1000*1000)), >> dtype=[('f0', np.int64), ('f1', np.int32)]) >> >> In [63]: %timeit sa['f0']

Re: [Numpy-discussion] Question about unaligned access

2015-07-06 Thread Jaime Fernández del Río
On Mon, Jul 6, 2015 at 10:18 AM, Francesc Alted wrote: > Hi, > > I have stumbled into this: > > In [62]: sa = np.fromiter(((i,i) for i in range(1000*1000)), dtype=[('f0', > np.int64), ('f1', np.int32)]) > > In [63]: %timeit sa['f0'].sum() > 100 loops, best of 3: 4.52 ms per loop > > In [64]: sa =

Re: [Numpy-discussion] Question about unaligned access

2015-07-06 Thread Francesc Alted
Oops, forgot to mention my NumPy version: In [72]: np.__version__ Out[72]: '1.9.2' Francesc 2015-07-06 17:18 GMT+02:00 Francesc Alted : > Hi, > > I have stumbled into this: > > In [62]: sa = np.fromiter(((i,i) for i in range(1000*1000)), dtype=[('f0', > np.int64), ('f1', np.int32)]) > > In [63]

[Numpy-discussion] Question about unaligned access

2015-07-06 Thread Francesc Alted
Hi, I have stumbled into this: In [62]: sa = np.fromiter(((i,i) for i in range(1000*1000)), dtype=[('f0', np.int64), ('f1', np.int32)]) In [63]: %timeit sa['f0'].sum() 100 loops, best of 3: 4.52 ms per loop In [64]: sa = np.fromiter(((i,i) for i in range(1000*1000)), dtype=[('f0', np.int64), ('