title: Why do matplotlib animations slow down when saving each successive frame?
body: <p>I've noticed that when I use Matplotlib to make an animation, it takes progressively longer for each frame to be saved. I know this, because I introduced a timing check into <code>/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py</code> inside the <code>print_figure</code> method of the <code>FigureCanvasBase class</code>:</p>
  
  <pre><code>        import time 
          t3=time.time() 
          result = print_method(
              filename,
              dpi=dpi,
              facecolor=facecolor,
              edgecolor=edgecolor,
              orientation=orientation,
              bbox_inches_restore=_bbox_inches_restore,
              **kwargs)
          t4=time.time()
          print("LOG:       backend_bases          -----",t4-t3) 
  </code></pre>
  
  <p>It took me some tracing to reach this point, and I've now hit the point of diminishing returns, since the print_method method seems to be determined dynamically. </p>
  
  <p>Does anyone know why it takes significantly longer to save the 100th frame of an animation as opposed to the first? </p>
  
  <p>I can avoid the problem by making several shorter animations and then stitching them together, but would prefer to understand why the problem exists in the first place. </p>
  
  <p>I would understand how periodically needing to obtain more memory could introduce periodic delays for saving every nth image, but do not understand a steady, almost linear rate, increase in the time required to save each succeeding frame. Is this caused by some sort of compression each time a new frame is added to an animation? Is memory reallocated each time an animation grows? Or is it something else?</p>