[Python-Dev] RE: [Patches] [Patch #102915] xreadlines : readlines :: xrange : range

Neil Schemenauer nas@arctrix.com
Tue, 2 Jan 2001 00:42:30 -0800


On Tue, Jan 02, 2001 at 09:56:40AM -0500, Guido van Rossum wrote:
> Now what to do?  I still don't like xreadlines very much, but I do see
> that it can save some time.  But my test doesn't confirm Neel's times
> as posted by Tim:
> 
> > Slowest: for line in fileinput.input('foo'):     # Time 100
> >        : while 1: line = file.readline()         # Time 75
> >        : for line in LinesOf(open('foo')):       # Time 25
> > Fastest: for line in file.readlines():           # Time 10
> >          while 1: lines = file.readlines(hint)   # Time 10
> >          for line in xreadlines(file):           # Time 10
> 
> I only see a factor of 3 between fastest and slowest, and
> readline is only about 60% slower than readlines_sizehint.

Could it be that your using the CVS version of Python which
includes Andrew's cool glibc getline enhancement?

  Neil