This page is optimized for mobile devices, if you would prefer the desktop version just click here

5.2 Branches

People sometimes take a week to make a decision, so we can’t fault a computer if it takes a few tens of nanoseconds. However, if an if-statement appears in some heavily traveled section of the code, you might get tired of the delay. There are two basic approaches to reducing the impact of branches:

  • Streamline them.
  • Move them out to the computational suburbs. Particularly, get them out of loops.

In [link] we show you some easy ways to reorganize conditionals so they execute more quickly.

<< Chapter < Page Page > Chapter >>

Read also:

OpenStax, High performance computing. OpenStax CNX. Aug 25, 2010 Download for free at http://cnx.org/content/col11136/1.5
Google Play and the Google Play logo are trademarks of Google Inc.
Jobilize.com uses cookies to ensure that you get the best experience. By continuing to use Jobilize.com web-site, you agree to the Terms of Use and Privacy Policy.