Re: optimizing apache with php and nfs mounts

2001-03-12 Thread Gordon Tetlow

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.

> this is my full config line so far
> CC="gcc -O6 -fomit-frame-pointer" OPTIM="-O2 -DBUFFERED_LOGS" ./configure
> --prefix=/usr/local/apache --enable-module=rewrite
> --activate-module=src/modules/php4/libphp4.a
>
> alot of other crap modules get thrown into httpd.conf as well i have
> noticedslowly researching each and disabling what i don;t need.

Unless you really need mod_rewrite, I suggest you don't use it. It's
rather black-magicish, difficult to get working, and as I recall, I think
it's had some security issues about it.

> INterested in talking with some c experts and apache experts on this
> issue.

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, 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). Again, I don't like living on the bleeding edge when it comes
to revenue streams.

Hope this helps,

-gordon


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



Re: optimizing apache with php and nfs mounts

2001-03-13 Thread David O'Brien

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



RE: optimizing apache with php and nfs mounts

2001-03-13 Thread Koster, K.J.

> 
>  _   _  
>  __/\_____  (_)   __ _  | |__ __/\__
>  \/   / __| | |  / _` | | '_ \\/
>  /_  _\   \__ \ | | | (_| | | | | |   /_  _\
>\/ |___/ |_|  \__, | |_| |_| \/  
>  |___/  
>
>
:-)

> 
> Where did you even get the idea "-O6" did *_ANYTHING_*??  Don't people
> ever read the documentation anymore.  
>
On top of that: the subject line suggests that NFS is involved in the
equation. Are you sure you're cpu-bound and aren't losing lots of time
getting files from the NFS server?

Kees Jan


 You are only young once,
   but you can stay immature all your life.

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



Re: optimizing apache with php and nfs mounts

2001-03-13 Thread Gordon Tetlow

On Tue, 13 Mar 2001, David O'Brien wrote:

> On Mon, Mar 12, 2001 at 10:34:32PM -0800, Gordon Tetlow wrote:
>  _   _
>  __/\_____  (_)   __ _  | |__ __/\__
>  \/   / __| | |  / _` | | '_ \\/
>  /_  _\   \__ \ | | | (_| | | | | |   /_  _\
>\/ |___/ |_|  \__, | |_| |_| \/
>  |___/

Woohoo! ASCII art!

> > 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?

I was just trying to illustrate that any gains (real or not) realized by
using -O1000 -fomit-everything is generally a trade off between stability
and speed.

> > 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.

Actually, we did. Of course, our production stuff is still compiled with
gcc 2.7.2.1. I think. Whatever the standard system compiler for
FreeBSD-3.2 is. And that was at a time when the world was still compiled
with -O2, wasn't it?

-gordon


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



Re: optimizing apache with php and nfs mounts

2001-03-13 Thread Alex Zepeda

On Tue, Mar 13, 2001 at 07:41:40AM -0800, David O'Brien wrote:

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

Well, yes.  But I think that with the pgcc patches floating around that do
use -ON N <= 9 or so.. people might get confused.

> 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)?

Yes.

> 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?

Well, yes.  I was actually curious about this, and if you search the gcc
ml archives (gcc.gnu.org) there are people who've been working on this.  
There was an interesting example of some fp code compiled with -O, -O2,
-O2 -fomit-frame-pointer.  With the extra register saved with
-fomit-frame-pointer -O2 was able to do some neat stuff.

Of course -O2 turns on most of the optimizations, but I wonder which ones
are causing incorrect code generation, and which ones really do help.  
Hmm.

- alex

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



Re: optimizing apache with php and nfs mounts

2001-03-13 Thread Alfred Perlstein

* Alex Zepeda <[EMAIL PROTECTED]> [010313 12:25] wrote:
> On Tue, Mar 13, 2001 at 07:41:40AM -0800, David O'Brien wrote:
> 
> > Where did you even get the idea "-O6" did *_ANYTHING_*??  Don't people
> > ever read the documentation anymore.  
> 
> Well, yes.  But I think that with the pgcc patches floating around that do
> use -ON N <= 9 or so.. people might get confused.
> 
> > 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)?
> 
> Yes.

Well... when you 'gzip -9' something, it just takes longer, it doesn't
sometimes corrupt your data (afaik).

So it sort of makes sense for people to assume that when the compiler
advertises certain things that it's going to do it perhaps not
in the most effecient manner, but at least correctly.

> Of course -O2 turns on most of the optimizations, but I wonder which ones
> are causing incorrect code generation, and which ones really do help.  
> Hmm.

SO are the gcc developers i imagine. :)

-- 
-Alfred Perlstein - [[EMAIL PROTECTED]|[EMAIL PROTECTED]]
Daemon News Magazine in your snail-mail! http://magazine.daemonnews.org/


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



Re: optimizing apache with php and nfs mounts

2001-03-13 Thread David O'Brien

On Tue, Mar 13, 2001 at 10:08:00AM -0800, Gordon Tetlow wrote:
> Actually, we did. Of course, our production stuff is still compiled with
> gcc 2.7.2.1. I think. Whatever the standard system compiler for
> FreeBSD-3.2 is. And that was at a time when the world was still compiled
> with -O2, wasn't it?

The world has _NEVER_ been compiled at -O2 by default, nor has it ever
been officially recommended.

-- 
-- 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



Re: optimizing apache with php and nfs mounts

2001-03-14 Thread Alex Zepeda

On Tue, Mar 13, 2001 at 12:51:19PM -0800, Alfred Perlstein wrote:

> Well... when you 'gzip -9' something, it just takes longer, it doesn't
> sometimes corrupt your data (afaik).

Hmm.  gzip seems to be pretty good about those things.  I guess it's one 
of the few GNU programs to be that way. :^)

> So it sort of makes sense for people to assume that when the compiler
> advertises certain things that it's going to do it perhaps not
> in the most effecient manner, but at least correctly.

Yes, hello pipe dream.  However, even the pgcc web page describes -O2 as
safe. 

I guess I'll be playing around to see which bits generate incorrect code
soon, since this is all so tempting.  What just popped into my mind was
that maybe some sort of check for stuff like "-fomit-frame-pointer" in
CFLAGS should be made in buildworld, since it will cause failure if you
build profiling libs.

Other thoughts include how -O2 is bombing out make world.  I know in my
dealings with kde I've had lots of trouble getting gcc to emit decent
debug info (depending on the code, -gstabs+, -ggdb3, etc would spit out
internal errors).

> SO are the gcc developers i imagine. :)

Pfft.  Damnit I want software that I don't have to pay for, to work
perfectly every time, and that I don't have to contribute to erm..  
Yes, scanning thru the ML leads me to believe some of these optimizations
are pretty much untested.  Which is kinda funny, since the ia32 bits are
the most used ones or so it seems.

- alex

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



Re: optimizing apache with php and nfs mounts

2001-03-14 Thread David O'Brien

On Wed, Mar 14, 2001 at 01:19:31AM -0800, Alex Zepeda wrote:
> However, even the pgcc web page describes -O2 as safe. 

I won't even to there...
 
> Yes, scanning thru the ML leads me to believe some of these optimizations
> are pretty much untested.  Which is kinda funny, since the ia32 bits are
> the most used ones or so it seems.

Not untested -- but you should go grab a graduate text on compiler
optimizations and familiarize yourself with the complexity of the problem.

If hello_world.c showed a problem with an optimization, I guarantee it
would be fixed.  The current test case of holding up the entire FreeBSD
kernel as showing an optimization problem doesn't cut it.  If you care to
trim it down to a single module showing the problem

-- 
-- 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



Re: optimizing apache with php and nfs mounts

2001-03-14 Thread Alex Zepeda

On Wed, Mar 14, 2001 at 02:58:40AM -0800, David O'Brien wrote:

> I won't even to there...

Well, the only reason I mentioned it.. was that the pgcc folks don't seem
to be too delusioned about the dangers.  -ON (N > 2) is regarded as at
least possibly in danger of generating incorrect code.

> Not untested -- but you should go grab a graduate text on compiler
> optimizations and familiarize yourself with the complexity of the problem.

Care to recommend any starting places.  You've piqued my interest.

> If hello_world.c showed a problem with an optimization, I guarantee it
> would be fixed.

Of course depending on the problem.

> The current test case of holding up the entire FreeBSD
> kernel as showing an optimization problem doesn't cut it.  If you care to
> trim it down to a single module showing the problem

Well I've just made buildworld with CFLAGS = "-O2 -march=pentiumpro
-malign-double" from a world built with the same flags.  Not so sure of
any performance impact however.

- alex

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



Re: optimizing apache with php and nfs mounts

2001-03-14 Thread David O'Brien

On Wed, Mar 14, 2001 at 03:12:41PM -0800, Alex Zepeda wrote:
> > Not untested -- but you should go grab a graduate text on compiler
> > optimizations and familiarize yourself with the complexity of the problem.
> 
> Care to recommend any starting places.  You've piqued my interest.

http://www.amazon.com/exec/obidos/ASIN/1558603204/ref=sim_books/107-1570516-8126104

Advanced Compiler Design and Implementation by Steven S. Muchnick
(typical graduate text cost of $93.00!)

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



gcc optimization problems (RE: optimizing apache with php and nfs mounts)

2001-03-13 Thread Charles Randall

From: David O'Brien [mailto:[EMAIL PROTECTED]]
>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.

Is this an issue with FreeBSD's gcc's or gcc in general? If gcc in general,
are there open PRs on this issue?

Charles

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