This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Implementing normal algorithms using predicate versions


On Mon, Nov 29, 2004 at 10:07:06AM +0100, Paolo Carlini wrote:
> Which is your opinion about my point (i.e, some times, for various reasons,
> -O2 is not usable and perhaps we don't want to penalize too much from the
> performance point of view unoptimized build)?!? I'm certainly up for Gaby/
> Benjamin/Chris proposal, but that issue worries me a little bit...

The GNU policy, if I understand it correctly, has been that we don't 
trade off peak performance for those who need it most (as evidenced 
by effort/money expended to get it) against aggregate performance for 
everybody else.   By that standard the library should do whatever it 
can to make -O3 perform as well as it possibly can, on the assumption 
that somebody who cares about performance will hack their source 
until the build doesn't blow up.  Then, under -O2 or -O1, the library 
need not be as fast etc. as it could be.  When it doesn't hurt -O3
performance, though, -O2 and -O performance are worth pursuing.

Another policy is that we prefer not to put complexity into the library 
to work around compiler optimization omissions.  I think the assumption
is that the compiler will improve, and also that the prospect of library
performance improvement helps to motivate compiler improvements.  (How
well this notion works in practice is not immediately clear.)

Since, by the policy, it doesn't matter for -O2 or better which choice 
we make, the question just is whether it's worth the effort to maintain 
all the extra source code (equated to complexity) just for the sake of 
-O.  That raises the question of just how much source code, and how 
much performance, is involved.  If the performance cost is not huge, 
and the amount of code is not trivial, then I think the policy favors 
making the change.

Nathan Myers
ncm-nospam@cantrip.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]