[Python-Dev] xreadlines : readlines :: xrange : range

Andrew Kuchling akuchlin@mems-exchange.org
Mon, 8 Jan 2001 16:15:34 -0500


On Mon, Jan 08, 2001 at 03:59:40PM -0500, Tim Peters wrote:
>200 chars).  (BTW, I'm still curious to know how that compares to the
>getc_unlocked hack on a platform other than Windows!)

On Solaris and Linux, the results seemed to be lost in the noise.
Repeated runs of filetest.py were sometimes faster than without
USE_MS_GETLINE_HACK, so the variation is probably large enough to
swamp any difference between the two.  (Assuming I enabled the getline
hack correctly of course; someone please replicate...)

--amk

Linux: w/o USE_MS_GETLINE_HACK
kronos Python-2.0>./python ~/filetest.py
total 1559913 chars and 32513 lines
count_chars_lines     0.186  0.190
readlines_sizehint    0.108  0.110
using_fileinput       0.447  0.450
while_readline        0.184  0.180

Linux w/ USE_MS_GETLINE_HACK:
kronos Python-2.0>./python ~/filetest.py
total 1559913 chars and 32513 lines
count_chars_lines     0.178  0.180
readlines_sizehint    0.108  0.110
using_fileinput       0.434  0.430
while_readline        0.183  0.190                                              
Solaris w/o USE_MS_GETLINE_HACK:
amarok src>./python ~/filetest.py
total 1559913 chars and 32513 lines
count_chars_lines     0.640  0.630
readlines_sizehint    0.278  0.280
using_fileinput       1.874  1.820
while_readline        0.839  0.840

Solaris w/ USE_MS_GETLINE_HACK:
amarok src>./python ~/filetest.py
total 1559913 chars and 32513 lines
count_chars_lines     0.569  0.570
readlines_sizehint    0.275  0.280
using_fileinput       1.902  1.900
while_readline        0.769  0.770