markflorisson88/cython — comment on commit d45850a2e3a8a493677807153806920f8c99aa79
File: Cython/Utility/MemoryView_C.c line 106
By markflorisson88:

It would be great to avoid this check, but can __attribute__ be
applied to an individual member of a struct? Because the member is
part of the memoryview object (so PyObject_HEAD must precede the
counter). Another problem (that could be overcome with a special case
in the compiler) is that the attribute is defined in Cython space,
where you can't have __attribute__ (that's not a real big problem).

I can try to do some testing later today to see how much faster it can
run without the alignment check. I don't except a really big
performance difference for the aligned case though, as an update to
the counter is already a function call (although maybe inlined) with
other checks in there (in inc_memviewslice function).

On 20 January 2012 12:06, Dag Sverre Seljebotn

wrote:
> Does this ever hit in normal circumstances? Would it OK to use __atttribute__(aligned(...)) when available on the memory view structs to disable this check? (I would imagine that in the circumstances where an atomic increment is possible, it would also be possible to ensure that the integers are always aligned...)
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/markflorisson88/cython/commit/d45850a2e3a8a493677807153806920f8c99aa79#commitcomment-885542