[Python-Dev] Alignment assumptions
Guido van Rossum
guido@python.org
Thu, 28 Feb 2002 09:03:51 -0500
> This is in
>
> #ifdef USE_CACHE_ALIGNED
> long aligner;
> #endif
>
> and AFAIK nobody ever defines the symbol. It's a cache-line
> optimization gimmick, but is effectively a nop (except to waste
> memory) on "almost all" machines. IIRC, the author never measured
> any improvement by using it (not surprising, since I believe almost
> all mallocs at least 8-byte align now). I vote we delete it.
The malloc 8-byte align argument doesn't apply, since this struct is
used in an array. Since the struct itself doesn't require alignment
beyond 4 bytes, the array entries can be 12 bytes apart. So I don't
think this is a nop -- I think it would waste 4 bytes per hash table
entry on most machines.
This was added by Jack Jansen ages ago -- I think he did measure a
speedup on an old Mac compiler, or he wouldn't have added it, and I
bet there was a #define USE_CACHE_ALIGNED in his config.h then.
But that's all history; I agree it should be deleted.
--Guido van Rossum (home page: http://www.python.org/~guido/)