Re: alignment of data-types

"Glen Herrmannsfeldt" <gah@ugcs.caltech.edu>
6 Feb 2003 00:16:31 -0500

          From comp.compilers

Related articles
Re: alignment of data-types gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-02-06)
RE: alignment of data-types onderkarpat@yahoo.com (Onder Karpat) (2003-02-11)
Re: alignment of data-types anton@mips.complang.tuwien.ac.at (2003-02-11)
Re: alignment of data-types markmcintyre@spamcop.net (Mark McIntyre) (2003-02-11)
Re: alignment of data-types gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-02-12)
| List of all articles for this month |

From: "Glen Herrmannsfeldt" <gah@ugcs.caltech.edu>
Newsgroups: comp.lang.c,comp.compilers
Date: 6 Feb 2003 00:16:31 -0500
Organization: AT&T Broadband
References: <3e3fbe78$0$49117$e4fe514c@news.xs4all.nl> <u6i04vgrps4ar212a1s8knie78jm193e63@4ax.com>
Keywords: architecture, practice
Posted-Date: 06 Feb 2003 00:16:31 EST

"Mark McIntyre" <markmcintyre@spamcop.net> wrote in message
news:u6i04vgrps4ar212a1s8knie78jm193e63@4ax.com...
> On Tue, 4 Feb 2003 14:22:00 +0100, in comp.lang.c , "R.A. Scheltema"
> <r.a.scheltema@dacolian.nl> wrote:
>
> >I'm currently working on a project which needs a lot of optimazation.
I've
> >been reading some stuff on aligning data-types, which would mainly be
> >important for avoiding cach-splits and some other preformance
optimizations.
>
> The first rule of optimisation is - don't do it yet.
> The second rule is - optimise the ALGORITHM first not the code.
>
> The sort of stuff you're talking about is very low level and should be
> done automatically by any good optimising compiler.
>
> You have little or no chance of being better at it than the guys who
> wrote it, at least not till you're a guru programmer, by which stage
> you won't need to ask us for advice....


Should, but not always true.


It is common for x86 compilers to allocate double variables on 4 byte
boundaries. This was optimal on the 386 and 486, but not on pentium
and later processors. The difference can be large.


I now added comp.compilers because I didn't think of a better place to
discuss the properties of a large number of compilers on different
systems. It might be nice to know which allocate on 4 and which on 8
byte boundaries.


-- glen


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.