Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 8/28/84; site lll-crg.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!umcp-cs!gymble!lll-crg!brooks From: brooks@lll-crg.ARPA (Eugene D. Brooks III) Newsgroups: net.lang.c Subject: The importance of alignment on a VAX Message-ID: <466@lll-crg.ARPA> Date: Sun, 17-Mar-85 12:37:48 EST Article-I.D.: lll-crg.466 Posted: Sun Mar 17 12:37:48 1985 Date-Received: Wed, 20-Mar-85 04:07:55 EST Distribution: net Organization: Lawrence Livermore Labs, CRG group Lines: 21 For those who think that aligment is not important on a VAX I suggest your actually trying a code without alignment before makeing any claims that it is not important. The very simple example for(i = 0; i < NTIMES; i += 1) { fa = fb + fc; da = db + dc; ia = ib + ic; } Where the variables f, d, i are floats, doubles and ints in static data has a speed reduction of a factor of two if you take out the .align pseudos and padd in some bytes to break alignment. Alignmet if very important as far as performance is concerned. For those who want to read structures from files using a single read the best course to follow is write the stuff into the file using the same structure. The padding for alignment is automatically taken care of. If the padding cant be tolerated then the most portable course of action is to read each data item into the structure seperately. This will save you a lot of headaches when moving your code from one machine to another.