[cygnus.project.sid] branch probability hinting
Tom Tromey
tromey@redhat.com
Mon Mar 5 15:54:00 GMT 2001
>> Also please everyone note that the compiler already knows that
>> if (p == NULL)
>> is unlikely
Hans> Presumably it will take a hint that it's likely, e.g. when
Hans> scanning a sparse chained hash table?
I don't know.
Hans> How do you tell gcc that the branch probability is around 50-50
Hans> if it already believes otherwise? (E.g. half the child pointers
Hans> in a binary tree are NULL.)
I don't think there is a way. Maybe this should be reported as a gcc
bug. Maybe you ought to be able to tell __builtin_expect the
probability that the branch is taken.
Tom
More information about the Java
mailing list