title: Assigning value to array seat is slow
body: <p>I am using temporal difference learning to train computer at playing go. I have noticed that my agent is really slow playing 1 game (like 10 seconds) when it should be able to play 100.000 games in about 20 minutes. After narrowing down the problem I have found out that line no. 5 in the following code is the troublemaker. The code is taken from a much larger function.</p>
  
  <pre><code>int i;
   double td = newValue - oldValueWhite;
   for(i = 0; i&lt;FEATURES_SIZE; i++)
   {
       Value[i] =Value[i] + alpha*(td)*((double)phiOldWhite[i]);
   }
  </code></pre>
  
  <p>However, the following code runs smooth as hell:</p>
  
  <pre><code> double tmp:
   int i;
   double td = newValue - oldValueWhite;
   for(i = 0; i&lt;FEATURES_SIZE; i++)
   {
       tmp =Value[i] + alpha*(td)*((double)phiOldWhite[i]);
   }
  </code></pre>
  
  <p>I am not sure if it is the compiler just ignoring the calculations or if the assigning of new value to Value[i] is really slow. Worth mentioning, Value is taken in as pointer to the function.</p>
  
  <p>Any ideas?</p>