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: std::max/min optimization


Nathan Myers <ncm-nospam@cantrip.org> writes:

| On Wed, Nov 26, 2003 at 10:17:03AM -0800, Ulrich Drepper wrote:
| > > Summing over all the programs that are actually run, 
| > > which produces a better overall result?
| > 
| > Completely irrelevant. 
| 
| In fact, the overwhelming majority of users don't have time to 
| hyper-optimize every build of everything, but are nonetheless 
| strongly affected by the choices we make.  That makes it relevant.

yes, but there is no substitute for documentation and education.
This is a compiler issue, and I'm not sympathetic to the approach of
obfuscating the library codes just to accomodate poorly choosen
compiler flags.  And those transformations (and subsequent
optimizations) are things that keep changing/improving as the compiler
is getting better.  Rather shift the burden to the right place.

| > You say it yourself:
| >
| > > on the assumption that
| > > users who care most about performance are using fast machines.
| > 
| > The fastest code for the fastest machine is generated with by gcc using
| > the plain old a > b ? a : b code.
| 
| That's true only if they compile, themselves, with "-march" options.  

if they care about speed, then they're rather using those options.

[...]

| "-O" alone is supposed to give good performance on the majority of 
| modern target machines.  That implies generating bitwise operations,
| in preference to branches, wherever it helps.
| 
| But this is now the wrowng list to discuss it.

yes, definitely.

-- Gaby


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