This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
RE: [Patch] Fix istream::ignore + minor things
- From: "Damour, James A" <James dot Damour at dfa dot state dot ny dot us>
- To: <gdr at integrable-solutions dot net>
- Cc: "Paolo Carlini" <pcarlini at suse dot de>,"libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Tue, 25 May 2004 10:10:50 -0400
- Subject: RE: [Patch] Fix istream::ignore + minor things
I'm quite inexperienced when it come to the GNU build chain in general
and gcc optimizations in particular, and I'm subscribed to this list as
a learning experience, so please forgive me if I have belabored the
obvious.
If I understand your position correctly, you recommend against the use
of the __builtin_expect function except when performance data shows a
clear improvement. Put a different way, you prefer brevity and clarity
in the source over some unproven performance improvement. Thus, I
believe that your answer to my question is, "unless the performance
improvement is demonstrated to be substantial, the more simple construct
has greater benefit".
Thank you for your clarification, and I apologize for not searching the
mail archives for previous discussions about this built-in function.
P.S. Paolo, I got your email too, but I believe that you were saying
approximately the same thing as Gaby (i.e. "don't use if unless you can
prove you need it").
-----Original Message-----
From: gdr@integrable-solutions.net [mailto:gdr@integrable-solutions.net]
Sent: Tuesday, May 25, 2004 8:29 AM
To: Damour, James A
Cc: Paolo Carlini; libstdc++
Subject: Re: [Patch] Fix istream::ignore + minor things
"Damour, James A" <James.Damour@dfa.state.ny.us> writes:
| Would your ignore code benefit from using __builtin_expect (see
| example below)?
|
| - if (__n != numeric_limits<streamsize>::max())
| + if (__builtin_expect(__n !=
| numeric_limits<streamsize>::max(),1))
I've asked in the past for data, in supporting the __builtin_expect
cluttering in the codes (not that I'm firmly opposed, but I would need
to see data). It was claimed that it would be faster with a different
compiler, but the actual experiment with GCC wa unconclusive. So far.
-- Gaby