www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/17/15:51:07

From: buers AT gmx DOT de (Dieter Buerssner)
Newsgroups: comp.os.msdos.djgpp
Subject: gcc optimization (Was: Executable size: limit to acceptability?)
Date: 17 Jan 2000 18:23:18 GMT
Lines: 50
Message-ID: <85vmml$23rse$1@fu-berlin.de>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000117161103 DOT 23941A-100000 AT is>
NNTP-Posting-Host: dialup-212.162.0.4.frankfurt1.mik.net (212.162.0.4)
Mime-Version: 1.0
X-Trace: fu-berlin.de 948133398 2224014 212.162.0.4 (16 [17104])
X-Posting-Agent: Hamster/1.3.8.0
User-Agent: Xnews/2.11.08
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

djgpp AT delorie DOT com (Eli Zaretskii) wrote in 
<Pine DOT SUN DOT 3 DOT 91 DOT 1000117161103 DOT 23941A-100000 AT is>:

>In what DJGPP distribution(s) did you see -O6?  

At least in allegro.

>AFAIK, the absolute 
>majority use -O2.  -O6 was a no-op until GCC 2.9x (or EGCS before it) 
>came into existence.

I believe, it was not a no-op, but rather was an alias to -O2.

Btw. I always use -O. For my programs this always almost produces
the fastest code. And I tried this with various hardware and 
with FPU intensive code as well as with code that doesn´t 
need the FPU. I started with djgpp on a 386SX with 16 MHz.
I thought this may be due to my ancient hardware. I upgraded to
an 486 with 66 MHz and used the -m486. Often the -m486 would result
in slower code and -O2 almost always produced slower code then -O.
Recently I upgraded to AMD K6-2 266 MHz (running at 333 MHz).
The same thing. Almost all my programs run fastest when compiled
with -O (and -fomit-frame-pointer -ffast-math).

Also I upgraded gcc. From (I believe) 1.39 upto 2.9.2 now.
The fastest code seems to be produced by 2.7.3. Even when I
compile with -march=k6 or -march=586 with 2.9.2, it won´t produce 
faster code then 2.7.3 in the examples I tested [1].

So, am I stupid or has anybody got similar experiences? Do all
the -O2 users have acutally tried to use -O only, or do you
all think, as I did, that higher optimization level should produce
faster code?

Note, theat my experiences are mostly for C, not for C++, which
I useally don´t use.

[1] I only have gcc 2.9.2 very recently. But I tested all I said
with gcc 2.8.x versions on many different programs, my own and
public available ones. I.e. my chess engine was about 20% slower
when compiled with 2.8 versions of gcc, compared to gcc 2.7.3.
The same is true for crafty, a freely available chess program.
Crafty uses unsigned long long extensively, while my program
doesn´t use it at all. Simular figures I obtained for quantum
chemical simulations.
 
Regards,
  Dieter


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019