rentzsch.com: tales from the red shed

Data Alignment Article

Links
IBM has a refreshed version of my data alignment article. I redid the figures, but for some reason IBM truncated the drop shadows at the last minute. Oh! My beautiful drop shadows!

I re-ran the tests I wrote for the original paper. The big news is the performance penalty for unaligned 8-byte access doubled from 2,372% (on a 400MHz G3) to 4,610% (on a 800MHz G4). Haven't tried on a G5 yet...

Update: Fellow deep-code-diver Ken Ferry asks:

When you declare a variable such that it takes memory off the stack, is it always x-aligned to some useful value of x?

Great question. Even better, Ken wrote some tests against gcc 3.3 to dredge up an answer. His results:

one-byte allocation => one-byte alignment
two-byte allocation => two-byte alignment
four-byte allocation => four-byte alignment
eight-byte allocation => eight-byte alignment
Anything else => sixteen-byte alignment

Ken also notes though he's testing on a G4 PowerBook setting the compiler flags "-mcpu=G5 -mtune=G5 -mpowerpc64 -mpowerpc-gpopt -force_cpusubtype_ALL" doesn't change the results.

Thursday, February 10, 2005
12:00 AM