title: Loop Tiling Optimisations
body: <p>I've been attempting to optimise one of my loops in my C code in order to make it use the cache more efficiently. I have a few issues. I'm not 100% sure if I'm even writing the code correctly to loop block due to the fact that I am seeing no increase in speed in the run time of my programme. Here is the code:</p>
  
  <pre><code>for(int k = 0; k &lt; N; k+=b){
    for (int i = k; i&lt;MIN(N,i+b); ++i) {
      a1[i] = 0.0f;
      a2[i] = 0.0f;
        for (int j = 0; j &lt; N; j++) {
             x = x[j] - x[i];
             y = y[j] - y[i];
             2 = x*x + y*y + eps;
             r2inv = 1.0f / sqrt(r2);
             r6inv = r2inv * r2inv * r2inv;
             s = m[j] * r6inv;
            ax[i] += s * x;
            ay[i] += s * y;
        }
    }
  }
  </code></pre>
  
  <p>I also have another issue. How do I go about choosing a correct block size? I understand that you want to load in enough to fill the l1 cache.</p>
  
  <p>Thanks for the help in advance.</p>