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

Greg Stein gstein@lyra.org
Mon, 8 Jan 2001 13:29:40 -0800


On Mon, Jan 08, 2001 at 04:15:34PM -0500, Andrew Kuchling wrote:
> 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.

Your times are so small... I'd suggest do a few iterations within
filetest.py so your margin of error isn't so noticable.

Cheers,
-g

>...
> 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

-- 
Greg Stein, http://www.lyra.org/