Subject: Re: one program, one machine, two wildly different execution times
To: None <>
From: Jim Bernard <>
List: current-users
Date: 04/20/2003 12:04:34
On Sun, Apr 20, 2003 at 10:14:30AM +1000, Ben Elliston wrote:
> Jim Bernard <> writes:
> >   My guess is that the two different execution times represent runs
> > in which the program was loaded with different alignments of
> > double-precision variables, one efficient and the other not.  I
> > tried compiling with -malign-double, but that made no difference.
> > I've tried a large number of variations in compile-time optimization
> > flags, including no optimization, and nothing made much of a
> > difference.
> I doubt that would make any difference; your variables should be bound
> to the same address in every run.

  Do you know of a way to verify that?

> Try compiling your program with -pg
> and see if gprof gives you any insight into where the extra time is
> being spent.  That might be a good starting point.

  Nothing useful.  Almost all of the time is spent in two routines in both
cases---both slow down in the slow case, as do most other routines that
use up enough time to actually show any time in the gprof output.  So, it
seems to be a general slowdown.

  I have tracked down a couple of tidbits that may relate to the problem:

This one, from a beowulf list in 1998:

describes a similar observation with some C code compiled with egcs on a
PII.  The poster eventually tracked it down to a dependence on the alignment
of the stack pointer on entry, which apparently was not always the same.

This one, from comp.compilers in 2000:

contains a small test program in C that demonstrates the difference in
speed of execution with aligned and unaligned doubles.  I tried it out
on the machine where I have been observing the timing variations, and
the difference, 55% slower in the unaligned case relative to the aligned
one, is quite close to the difference I'm seeing (about 51% or so).

  Thanks for the tip; I'll be glad to have more if you have more to offer.