[Patches] [Patch #102915] xreadlines : readlines :: xrange : range

noreply@sourceforge.net noreply@sourceforge.net
Thu, 04 Jan 2001 09:47:35 -0800


Patch #102915 has been updated. 

Project: python
Category: Modules
Status: Open
Submitted by: jepler
Assigned to : gvanrossum
Summary: xreadlines : readlines :: xrange : range

Follow-Ups:

Date: 2001-Jan-01 09:59
By: gvanrossum

Comment:
Bah.  I don't like this one bit.  More complexity for a little bit of extra
speed.
I'm keeping this open but expect to be closing it soon unless I hear a
really good argument why more speed is really needed in this area.  Down
with code bloat and creeping featurism!

-------------------------------------------------------

Date: 2000-Dec-30 02:33
By: loewis

Comment:
This patch appears to be incomplete. There is no documentation of the
feature, and no other file-like object is touched: StringIO, cStringIO,
gzip, codecs.
-------------------------------------------------------

Date: 2000-Dec-18 19:32
By: jepler

Comment:
This patch implements an object 'xreadlines' in C, as well as a method on
the file object to create one.

xreadlines will let a 'for' loop iterate over the contents of a file
without reading the whole file, yet at a speed almost equal to that of 'for
line in f.readlines()'.  Internally, it uses f.readlines(sizehint).

Includes a test suite and a version of fileinput which uses it (approx. 50%
speedup in fileinput as well).  fileinput is not tested by test suite entry.
-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=102915&group_id=5470