|
|
|
|
|
by Tiddles-the2nd
8 days ago
|
|
The check isn't important; what's important is being predictable so the CPU can guess which way the check will go. I don't know exactly how it works, but after the first couple of loops, the predictor will assume it's always going to end up in the loop and make that the fast path. It may guess wrong the first couple of loops, and the last check wrong, but the other 997 will be correct. |
|
So the jump that forms the loop will be predicted correctly for all executions but the very last (when the loop ends).