title: Dramatic speed difference between PDF to PNG vs. PDF to JPEG
body: <p>Using <code>pdftocairo</code>, on a Xeon E5-2630 (2.3GHz) CentOS 6.3 machine, poppler 0.24, cairo 1.12, libpng 1.2.49, openjpeg 1.3.10 (both CentOS default), I tested converting a 37 page PDF to convert to JPEG and PNG.  I ran <code>pdftocairo</code> with no special options (so no alpha channel for png, with density at 150ppi). The speed difference is enormous:</p>
  
  <p>PDF to PNG:</p>
  
  <pre><code>real    0m16.858s
  user    0m16.552s
  sys     0m0.154s
  </code></pre>
  
  <p>That works out to about 0.43s per page.</p>
  
  <p>PDF to JPEG:</p>
  
  <pre><code>real    0m1.762s
  user    0m1.666s
  sys     0m0.081s
  </code></pre>
  
  <p>Which is, well, like 10 times faster.</p>
  
  <p>Now I also tested using GS to do the convert, with basically the same options, and the results are:</p>
  
  <p>PDF to PNG:</p>
  
  <pre><code>real    0m16.500s
  user    0m16.223s
  sys     0m0.093s
  </code></pre>
  
  <p>Almost identical in speed to poppler, strangely.</p>
  
  <p>PDF to JPEG:</p>
  
  <pre><code>real    0m7.468s
  user    0m7.304s
  sys     0m0.079s
  </code></pre>
  
  <p>Much slower than poppler, somehow, but I included this just for comparison.</p>
  
  <p>Why is converting to PNG so much slower?  I need to convert them to PNGs, could there be something wrong with my libpng setups?  It's curious that GS is so much slower when converting the JPEGs but almost identical for PNGs.</p>