speed problems
Grant Edwards
grante at visi.com
Thu Jun 3 11:58:12 EDT 2004
On 2004-06-03, Roel Schroeven <rschroev_nospam_ml at fastmail.fm> wrote:
> Axel Scheepers wrote:
>
>> Another difference might be while( <filehandle>) and line in lf.readlines().
>> The latter reads the whole file to memory if I'm not mistaken as the former
>> will read the file line by line. Why that could make such a difference I
>> don't know.
>
> line in lf also reads the file line by line, if you're using 2.3. In 2.1
> or 2.2 you can use xreadlines for that. I don't if it makes any
> difference in performance though, for small files.
I would suspect that reading the entire file at once would yeild
slightly better performance for non-huge files.
--
Grant Edwards grante Yow! My ELBOW is a remote
at FRENCH OUTPOST!!
visi.com
More information about the Python-list
mailing list