title: Is discard bad for program performance in OpenGL?
body: <p>I was reading <a href="http://code.google.com/p/gdc2011-android-opengl/wiki/TalkTranscript" rel="noreferrer">this</a> article, and the author writes:</p>
  
  <blockquote>
    <p>Here's how to write high-performance applications on every platform in two easy steps:<br>
    [...]<br>
    Follow best practices. In the case of Android and OpenGL, this includes things like "batch draw calls", "don't use discard in fragment shaders", and so on. </p>
  </blockquote>
  
  <p>I have never before heard that discard would have a bad impact on performance or such, and have been using it to avoid blending when a detailed alpha hasn't been necessary.</p>
  
  <p>Could someone please explain why and when using discard might be considered a bad practise, and how discard + depthtest compares with alpha + blend?</p>
  
  <p><strong>Edit:</strong> After having received an answer on this question I did some testing by rendering a background gradient with a textured quad on top of that.  </p>
  
  <ul>
  <li>Using GL_DEPTH_TEST and a fragment-shader ending with the line "<code>if(
  gl_FragColor.a &lt; 0.5 ){ discard; }</code>" gave about <strong>32 fps</strong>.</li>
  <li>Removing the if/discard statement from the fragment-shader increased
  the rendering speed to about <strong>44 fps</strong>.</li>
  <li>Using GL_BLEND with the blend function "(GL_SRC_ALPHA,
  GL_ONE_MINUS_SRC_ALPHA)" instead of GL_DEPTH_TEST also resulted in around <strong>44 fps</strong>.</li>
  </ul>