Re: Order of expressions to minimize branch mis-predictions?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 28, 2016 at 11:51 AM, Tim Prince <n8tm@xxxxxxx> wrote:
> Most CPU s are designed to favor forward conditional branches not taken, as
> far as static prediction is concerned. This should correspond with the
> priorities you quoted. If you wish to change the code generation to favor a
> given training set (without sorting source code), you may try the profile
> guided feature of your compiler.
> In some cases where several branches are likely, putting the shortest cases
> first may be helpful.

Thanks Tim.

I audited a class that provides a BigInteger in C++. It performed well
before the profile driven changes. Reordering the statements to take
advantage of the profiling data sped up public key operations. It was
a small change, but it was measurable and repeatable. It also looks
like newer processors benefit the most.

Jeff



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux