[v3] conditional tweak
Gabriel Dos Reis
gdr@integrable-solutions.net
Fri Nov 7 21:35:00 GMT 2003
Phil Edwards <phil@jaj.com> writes:
| On Thu, Nov 06, 2003 at 03:05:31AM +0100, Gabriel Dos Reis wrote:
| > Jerry Quinn <jlquinn@optonline.net> writes:
| >
| > | 2003-11-05 Jerry Quinn <jlquinn@optonline.net>
| > |
| > | * 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
More information about the Gcc-patches
mailing list