On Sun, Mar 30, 2008 at 05:17:42AM -0400, Robert P. J. Day wrote: > oh, i realize what they *represent*. what i was curious about was the > actual numerical *benefit*. as in, performance analysis and how much > of a difference it really makes. did someone do any benchmarking? The gcc manual says that programmers are very bad at guessing which branch will be taken and suggests to profile the application and feed the profile results to the compiler (see -fprofile-arcs and -fbranch-probabilities options). This is not possible with the kernel, so most of the time people just look at overall performance and guess what's best. If you look at the kernel source, likely()/unlikely() is mostly used at places where it is obvious: in an ethernet driver it's unlikely that the transfered amount of data is larger than the maximum ethernet frame length, it's unlikely that the ext3 filesystem can't read the block bitmap, etc. Of course you can profile this, but you will see that the programmer was right for these cases. Erik -- Erik Mouw -- mouw@xxxxxxxxxxxx
Attachment:
signature.asc
Description: Digital signature