Jeff Garzik wrote: > In x86-based CPUs at least (the largest tg3 platform), branch > prediction > often prefers > > if (...) > direct_func_1() > else > direct_func_2() > > to > > tp->func() >
The following is from Intel Pentium 4 and Intel Xeon ProcessorOptimization page 2-20: Indirect branches, such as switch statements, computed GOTOs or calls through pointers, can jump to an arbitrary number of locations. If the code sequence is such that the target destination of a branch goes to the same address most of the time, then the BTB will predict accurately most of the time. If, however, the target destination is not predictable, performance can degrade quickly. If tg3 is loaded on multiple chips using the same register access function pointers, the destinations of the indirect calls will be the same and the destinations should be predicted correctly by the BTB. If on the other hand, tg3 is loaded on different chips all using different access function pointers, and there is steady and equal amount of traffic going through all these chips, I suppose the call destinations will no longer be predictable most of the time. But in this scenario, I doubt that conditional branches with direct calls will fare any better. - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html