I think the problem is that branches can be very expensive when mispredicted, somtimes >100 cycles on a P4. So there is a general myth that all branches should be avoided at all costs. When realy only branchs that are likely to be frequently mispredicted should be avoided. Ones that a likely to switch randomly. The overwhelming majority of branches are corectly predicted on modern CPUs, i've read that they get it right close to 99% of the time.Kingston wrote:got me curious. do you just look at the input, see if a bunch of zeros come in, and bypass the process (or reversed when turning it back on)? the way I see it, this is a few adds and a call to bypass - takes practically no CPU cycles. or are there some other considerations as well?tony tony chopper wrote:the test we're talking about, you could run thousands and not notice it
But, the point is, most of the time the programer know what the branch is going to do. Checking for silence is almost always going to have input or silence for very long periods of time. It will be perfectly well predicted >99% of the time. Which means in region of 5-10 cycles taking into acount ocaisional mispredictions, maybe even less.


