About deletion of variables in version 2.1
Juan Huertas
jhg at galdon.com
Fri Mar 8 14:25:12 EST 2002
Hi all.
I'm working with large list or dict an have problems with the deletion and
time of response, this problems does not exist in version 2.0:
Reading a large file and loading to a list:
f=open('c:/xx','rb')
ls=[]
while not eof:
ln=f.readline()
ls.append(ln)
This takes 5 seconds (reasonable)
The new instruction:
ls=[] # or del ls
Takes about 10 seconds and use 100% of Memory!!!!
And a continuation repeating the proccess:
while not eof:
ln=f.readline()
ls.append(ln)
This takes about 30 seconds !!!
Why? (please aid)
The comprobation is in Windows 2000 and pythonwin
If i try with a new variable, p.e. lx=[] and not refer to ls, the process
take 5 seconds.
More information about the Python-list
mailing list