[Python-Dev] mingw32 and gc-header weirdness
Neil Hodgson
nyamatongwe at gmail.com
Sat Jul 25 16:11:30 CEST 2009
Martin v. Löwis:
> I propose to add another (regular) double into the union.
Adding a regular double as a second dummy gives the same sizes and
alignments with Mingw or MSVC as the original definition with MSVC:
typedef union _gc_head {
struct {
union _gc_head *gc_next;
union _gc_head *gc_prev;
Py_ssize_t gc_refs;
} gc;
long double dummy; /* force worst-case alignment */
double dummy2; /* in case long double doesn't trigger worst-case */
} PyGC_Head;
In regard to alignment penalties, a simple copy loop for doubles
runs about 20% slower when misaligned on an my AMD processor. Other
x86 processors can be much worse. As much as 2 to 3.25 times according
to
http://msdn.microsoft.com/en-us/library/aa290049%28VS.71%29.aspx
Neil
More information about the Python-Dev
mailing list