This is the mail archive of the mailing list for the GCC 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: [v3] conditional tweak

Phil Edwards <> writes:

| On Thu, Nov 06, 2003 at 03:05:31AM +0100, Gabriel Dos Reis wrote:
| > Jerry Quinn <> writes:
| > 
| > | 2003-11-05  Jerry Quinn  <>
| > | 
| > | 	* include/bits/basic_ios.h (basic_ios::fill):  Use
| > |         __builtin_expect.
| > 
| > Does it make a real measurable difference?
| While I haven't measured Jerry's particular patch, on machines with deep
| pipelines, an incorrectly-predicted branch can be a significant stall
| (most/all of the pipeline has to be cleared).

In theory, yes.  In this particular case, we're speaking of an I/O
formatting flag setting which is nowhere a bottleneck (expect probably
in a testsuite). 

|  My own opinion is that
| we should use __builtin_expect anywhere we (the humans) can reasonably
| predict the result.

When I first suggested use of __builtin_expect in V3 a while ago, I
suggested the idea of using it as where as possible.  I believe RTH
remarked that that would really make difference only in frequently
taken code paths, and he wasn't positive about its liebral use.   
basic_ios<T>::fill isn't a tight loop of a frequently taken path.  
I would like to see measurements before we start springling
__builtin_expect everywhere.

-- Gaby

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