[FEEDBACK] Is this script efficient...is there a better way?

Michael Schneider michaels at one.net
Wed Sep 11 22:08:35 EDT 2002


Bob X wrote:

>
>> 1) readlines() loads the entire file into a list so if you have a 30+ 
>> mb file you just ate 30+mb of memory.  Try using xreadlines() 
>> instead, it reads the file line by line and is much more memory 
>> friendly.
>
> Very cool...I had missed that! 


It is much slower though.  I am not sure about your config, but I am 
running with a Gig of memory.
I would much rather have the speed then the  30 mb of memory.  Again, 
check your config.





More information about the Python-list mailing list