title: Generator speed in python 3
body: <p>I am going through a <a href="http://www.dabeaz.com/generators/Generators.pdf" rel="nofollow noreferrer">link about generators</a> that someone posted. In the beginning he compares the two functions below. On his setup he showed a speed increase of 5% with the generator. </p>
  
  <p>I'm running windows XP, python 3.1.1, and cannot seem to duplicate the results. I keep showing the "old way"(logs1) as being slightly faster when tested with the provided logs and up to 1GB of duplicated data. </p>
  
  <p>Can someone help me understand whats happening differently?</p>
  
  <p>Thanks!</p>
  
  <pre><code>def logs1():
      wwwlog = open("big-access-log")
      total = 0
      for line in wwwlog:
          bytestr = line.rsplit(None,1)[1]
          if bytestr != '-':
              total += int(bytestr)
      return total
  
  def logs2():
      wwwlog = open("big-access-log")
      bytecolumn = (line.rsplit(None,1)[1] for line in wwwlog)
      getbytes      = (int(x) for x in bytecolumn if x != '-')
      return sum(getbytes)
  </code></pre>
  
  <p>*edit, spacing messed up in copy/paste</p>