On Mon, Mar 12, 2001 at 10:34:32PM -0800, Gordon Tetlow wrote:
> On Mon, 12 Mar 2001, Dan Phoenix wrote:
> 
> > CC="gcc -O6 -fomit-frame-pointer" OPTIM="-O2 -DBUFFERED_LOGS"
> >
> > could some c guru tell me if this would be bad to use to an apache
> > optimization? I need to compile apache on my own not with ports....
> > looking at makefile
> > in apache13 in ports collection i see these optimization flags.
> > along with --mmap-static module.
> >
> >
> > can you use both -06 and -02 for optmization at the same time?
> > -fomit-frame-pointer as well?
> 
> -O6 and -O2 do seem a bit contradictory. I'm guessing it just uses -O6.
> -fomit-frame-pointer is not enabled per the -O flags so that does do
> something, but it does make it rather difficult to track down problems
> without a frame pointer.

                 _           _              
 __/\__    ___  (_)   __ _  | |__     __/\__
 \    /   / __| | |  / _` | | '_ \    \    /
 /_  _\   \__ \ | | | (_| | | | | |   /_  _\
   \/     |___/ |_|  \__, | |_| |_|     \/  
                     |___/                  

Where did you even get the idea "-O6" did *_ANYTHING_*??  Don't people
ever read the documentation anymore.  

1.  The highest -O setting GCC accepts is "-O3".
2.  The base, system C compiler is known to produce bad code with -O2.
    We have been proclaiming this since as long as I have been with the
    Project.

> I probably qualify for the latter.... Optimizations are good and all, but
> I look at it this way: It's a mission critical webserver, I don't want it
> crashing. As a result, we compile ours with nothing higher that -O2 and no
> unusual optimizations. Sure, it might be a bit slower than it could have
> been,

Do people ever actually test this?  Or is there just the assumption that
the more "optimizations" on the `cc' command line is a Great Thing(tm)?
People do realize that for some code, -O2 is much worse than -O?  Also
for much code there is no difference in performance.  Rather than do what
you "think" will give the best results, why not actually benchmark it?

> but we don't have to worry about chasing down compiler bugs that
> interact strangly with the webserver code. Also, I think anything higher
> than -O2 actually produces a larger binary (it inlines functions whenever
> possible).

1.  You need to use -O if you don't want to chase bugs
2.  It is -O2 and above (ie, _includes_ -O2) that produces a larger
    binary.  See -Os if you want smaller.

-- 
-- David  ([EMAIL PROTECTED])
          GNU is Not Unix / Linux Is Not UniX

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to