[Numpy-discussion] GSOC 2013
Wed Mar 6 12:56:47 CST 2013
On 2013/03/05 8:14 AM, Kurt Smith wrote:
> On Tue, Mar 5, 2013 at 1:45 AM, Eric Firing <email@example.com> wrote:
>> On 2013/03/04 9:01 PM, Nicolas Rougier wrote:
>>>>> This made me think of a serious performance limitation of structured dtypes: a
>>>>> structured dtype is always "packed", which may lead to terrible byte alignment
>>>>> for common types. For instance, `dtype([('a', 'u1'), ('b',
>>>>> 'u8')]).itemsize == 9`,
>>>>> meaning that the 8-byte integer is not aligned as an equivalent C-struct's
>>>>> would be, leading to all sorts of horrors at the cache and register level.
>> Doesn't the "align" kwarg of np.dtype do what you want?
>> In : dt = np.dtype(dict(names=['a', 'b'], formats=['u1', 'u8']),
>> In : dt.itemsize
>> Out: 16
> Thanks! That's what I get for not checking before posting.
> Consider this my vote to make `aligned=True` the default.
I strongly oppose this, because it would break the common usage of
structured dtypes for reading packed binary data from files. I see no
reason to change the default.
>> NumPy-Discussion mailing list
> NumPy-Discussion mailing list
More information about the NumPy-Discussion