Mailinglist Archive: opensuse (3666 mails)

< Previous Next >
Re: [SLE] What is the proper way to optimize compilations?
  • From: "Carlos E. R." <robin1.listas@xxxxxxxxxx>
  • Date: Wed, 23 Mar 2005 22:41:03 +0100 (CET)
  • Message-id: <Pine.LNX.4.58.0503232220000.10344@xxxxxxxxxxxxxxxx>

The Tuesday 2005-03-15 at 08:33 -0600, Danny Sauer wrote:

(I was thinking...)

> On Sunday 13 March 2005 06:58 am, Carlos E. R. wrote:
> > Hi,
> >
> > I have a P-IV, and when I compile something I like to have it optimized
> > for my cpu. The proper switch to give gcc would be "-march=pentium4".
> [...]
> > Can you suggest a better, and general, method?
> Well, you could run Gentoo, but then you're compiling *everything*, not just
> "something" (not too bad, on a quick machine, and the distro actually has
> some benefits - but that's not what you asked).


Not that I would not like to have a single command I could issue and have
everything that I have installed from the dvd automatically recompiled...
but then YOU patches would get more complicated, to say nothing about
support. A nightmare they would say, I guess ;-)

No, I'm happy enough recompiling only certain applications. In this case,
I was doing so with Xine, and I think multimedia is quite demanding, and
the pentium4 has instructions for multimedia.

> However, I've had pretty
> good luck with just exporting CFLAGS="-march=pentium4" and
> CXXFLAGS=$CFLAGS. Most automake-based programs will respect that.

But... don't those settings replace completely whatever they had? If this
settings get added to theirs, I'm happy enough.

Time ago (SuSE 7.3 perhaps) there was a file I modified in the gcc config
that changed the default compilation for everything. I can't find it after
gcc version 3.

> Actually, I throw a "-Os -pipe" in there, too, but that's just me...

What does it do? Ah:

Optimize for size. `-Os' enables all `-O2' optimizations that do
not typically increase code size. It also performs further
optimizations designed to reduce code size.

`-Os' disables the following optimization flags:
-falign-functions -falign-jumps -falign-loops
-falign-labels -freorder-blocks -fprefetch-loop-arrays

I usually do "-O2", except on my small "pentium-120" where I select -Os as
you do. When memory is scarce, optimizing for size makes systems faster
(less swapping).

And -pipe? I can't find now the index to all options in the info page. Ah!
yes, found it:

Use pipes rather than temporary files for communication between the
various stages of compilation. This fails to work on some systems
where the assembler is unable to read from a pipe; but the GNU
assembler has no trouble.

Hum. What advantage has this, is it faster perhaps? Does the system use
memory pipes perhaps?

> You can also set --host=i686-pc-linux-gnu if it's not being set correctly yb
> default.

I get "i686-pc-linux-gnu".

But it seems I have to set both --build and --host. The info page is not
absolutely clear on it. I understand that the pentium4 is a 787, isn't it?
I don't know if I have to give "i786-pc-linux-gnu" or

Carlos Robinson

< Previous Next >