title: How does one write code that best utilizes the CPU cache to improve performance?
body: <p>This could sound like a subjective question, but what I am looking for are specific instances, which you could have encountered related to this.</p>
  
  <ol>
  <li><p>How to make code, cache effective/cache friendly (more cache hits, as few cache misses as possible)? From both perspectives, data cache &amp; program cache (instruction cache),
  i.e. what things in one's code, related to data structures and code constructs, should one take care of to make it cache effective.</p></li>
  <li><p>Are there any particular data structures one must use/avoid, or is there a particular way of accessing the members of that structure etc... to make code cache effective.</p></li>
  <li><p>Are there any program constructs (if, for, switch, break, goto,...), code-flow (for inside an if, if inside a for, etc ...) one should follow/avoid in this matter?</p></li>
  </ol>
  
  <p>I am looking forward to hearing individual experiences related to making cache efficient code in general. It can be any programming language (C, C++, Assembly, ...), any hardware target (ARM, Intel, PowerPC, ...), any OS  (Windows, Linux,S ymbian, ...), etc.. </p>
  
  <p>The variety will help to better to understand it deeply.</p>