Re: Just in case you were wondering if alignment matters...

2001-04-23 Thread Larry Wall
As a general rule of thumb, if you sort your structs into decreasing size, it usually comes out right. That is, put all your 64-bit items first, then all your 32-bit items, then 16-bit, then 8-bit. Then there are no "holes" except the one at the end, which most compilers are pretty good at keepi

Re: Just in case you were wondering if alignment matters...

2001-04-17 Thread Dan Sugalski
At 09:05 PM 4/17/2001 +0100, Alan Burlison wrote: >Uri Guttman wrote: > > > malloc normally doesn't care about alignment. > >I'll think you will find it does care. I'm pretty sure that everyone's malloc returns data aligned to the CPU's favorite boundary. It's what we do with the malloc'd area t

Re: Just in case you were wondering if alignment matters...

2001-04-17 Thread Alan Burlison
Uri Guttman wrote: > malloc normally doesn't care about alignment. I'll think you will find it does care. Alan Burlison

Re: Just in case you were wondering if alignment matters...

2001-04-13 Thread Uri Guttman
> "NC" == Nicholas Clark <[EMAIL PROTECTED]> writes: NC> On Fri, Apr 13, 2001 at 04:38:45PM -0400, Dan Sugalski wrote: >> It actually matters more for dynamic data structures, as compilers >> tend to queitly align things well for you. It's tough to get stack >> variables unaligned, b

Re: Just in case you were wondering if alignment matters...

2001-04-13 Thread Nicholas Clark
On Fri, Apr 13, 2001 at 04:38:45PM -0400, Dan Sugalski wrote: > It actually matters more for dynamic data structures, as compilers tend to > queitly align things well for you. It's tough to get stack variables > unaligned, but it's pretty easy to get dynamically allocated ones all messy. At whi

Re: Just in case you were wondering if alignment matters...

2001-04-13 Thread Dan Sugalski
At 06:36 PM 4/12/2001 -0400, Uri Guttman wrote: > > "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes: > > DS> The only difference between the aligned and unaligned runs is the > DS> pointer to the aligned data is on an 8-byte boundary, and the > DS> unaligned data is the aligned pointer p

Re: Just in case you were wondering if alignment matters...

2001-04-12 Thread Uri Guttman
> "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes: DS> The only difference between the aligned and unaligned runs is the DS> pointer to the aligned data is on an 8-byte boundary, and the DS> unaligned data is the aligned pointer plus 1. i am assuming this is an alpha (which i got to kn

Re: Just in case you were wondering if alignment matters...

2001-04-12 Thread Dan Sugalski
At 12:15 AM 4/13/2001 +0200, Kai Henningsen wrote: >[EMAIL PROTECTED] (Dan Sugalski) wrote on 12.04.01 in ><[EMAIL PROTECTED]>: > > > (No, I don't know why unaligned access to 8-bit data is faster, but there > > you go) > >How *do* you unalign 8-bit data?! (Must... resist... straight... line...

Re: Just in case you were wondering if alignment matters...

2001-04-12 Thread Kai Henningsen
[EMAIL PROTECTED] (Dan Sugalski) wrote on 12.04.01 in <[EMAIL PROTECTED]>: > (No, I don't know why unaligned access to 8-bit data is faster, but there > you go) How *do* you unalign 8-bit data?! MfG Kai

Just in case you were wondering if alignment matters...

2001-04-12 Thread Dan Sugalski
It does. I ran a test here earlier today on the cost of mis-aligned data access, and I figured the results would be of interest to folks in general. A few caveats--this test was run on a lightly loaded Compaq TurboLaser with 6 700MHz EV6 processors and 16G of memory. There was no swapping, and