title: Which is faster? Comparison or assignment?
body: <p>I'm doing a bit of coding, where I have to write this sort of code:</p>
  
  <pre><code>if( array[i]==false )
      array[i]=true;
  </code></pre>
  
  <p>I wonder if it should be re-written as</p>
  
  <pre><code>array[i]=true;
  </code></pre>
  
  <p>This raises the question: are comparisions faster than assignments?</p>
  
  <p>What about differences from language to language? (contrast between java &amp; cpp, eg.)</p>
  
  <p><em>NOTE: I've heard that "premature optimization is the root of all evil." I don't think that applies here :)</em></p>