Help mi please with optimalization of simple Python code
Chrabros
chrabros at seznam.cz
Tue Oct 1 11:43:13 EDT 2002
Hello,,
I have written my first simple application in Python and I have a
problem that processing of cca 10MB file takes ages (30 seconds).
I think that problem is in data structure used.
Could you please give me an advice how to optimize the following
piece of code?
Thank you in advance.
Dalibor
while y<maxY :
x=0
line = file.read(maxX*2)
while x<maxX :
val = ord(line[x*2+2])*256 + ord(line[x*2+3])
... here are some contditions which count the occurences
of unique values of val
x=x+2
y=y+2
I think that main problem is in usage of string "line" but I
do not know how to it different way.
More information about the Python-list
mailing list