Also, processors learn expected branch directions, so you'll probably only see a difference for the first iteration of a loop anyway.įor pure curiosity purposes, you might want to look at some of Agner Fogs work - but don't expect light reading. Format: Kindle eBook By: Stokes, Jon Binding: Kindle Edition. Except that typical compilers are clever enough that they'll probably resolve that issue by ordering the object code differently from the source. An Illustrated Introduction to Microprocessors and Computer Architecture. One has a forward conditional jump, one has a backward conditional jump. while (condition ()) while (condition ()) The following might have different performance. What affects branch prediction accuracy is which direction you branch. And whether you have the call within the if statement, or store the result in the temporary variable, probably makes no difference to the generated code anyway - optimisers are pretty good at avoiding unnecessary memory accesses. The way I understand it, where the test value is stored will make no difference to branch prediction. Inside the Machine by Jon Stokes - Z-Library Main Inside the Machine Inside the Machine Jon Stokes 5.0 / 4.
0 Comments
Leave a Reply. |