branch probability hinting
Greg McGary
greg@mcgary.org
Thu Mar 1 09:32:00 GMT 2001
Dave Brolley <brolley@redhat.com> writes:
> The problem I have with
>
> if (LIKELY (test))
> ...code...
>
> is that to a casual reader it looks like it's an actual test for
> something which is likely (a heuristic?) rather than an optimization hint.
I generally don't buy such arguments. The casual reader generally
deserves any misunderstandings s/he has. If it's truly casual
reading, then the misunderstandings are inconsequential. If someone
really cares to know what's going on, then it's time to become more
circumspect and track down the definition. This same procedure
applies to zillions of other names in a program that might be
unfamiliar. LIKELY/UNLIKELY is as evocative of its real meaning for
me as some other choice of names is for you. As Abe Lincoln once
said: "You can please some of the people all of the time, you can
please all of the people some of the time, but you can't please all of
the people all of the time."
Greg
More information about the Sid
mailing list