Ilya Zakharevich on Fri, 7 Jan 2000 21:45:41 -0500

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: optimization flags

On Fri, Jan 07, 2000 at 07:54:48PM -0500, Igor Schein wrote:
> a couple of remarks about gcc default optimization flags.  First of
> all,  -fexpensive-optimizations doesn't need to be used because
> it's automatically  turned on by -O2 and higher.  Second, my
> measurements indicated that -O3 is faster than -O2 on Solaris.  The
> only difference between them is that -finline-functions is added with
> -O3, which clearly improves speed.  I don't know why it's
> traditionally been -O2 on Solaris, but I think it should be changed
> now. 

In older versions -O2 was maximum.

> In addition, -fomit-frame-pointer flag is always desirable for
> optimized binary because it saves some unneeded instructions.

What is more important, it frees a register on x86.  But I think it is
included in some numeric range, -O4?

> And finally, -frunroll-loops and -funroll-all-loops could also be
> beneficial, but I will need to verify that.

How do you do it?  I found Ultra5 absolutely useless for benchmarking,
the speed of the same program on the same "unused" machine varies up
to 90% when phase of sun changes.  Sun's engineers say that this is
due to "cache coloring", which may be switched on and off in PROM (but
switching it off decreases performance).  Does somebody know what they
are talking about?