logo       

optimising render code: msg#00156

python.pygame

Subject: optimising render code

hi

i am trying to find the fastest way to render objects in a stack. After some tests i found that given a unidimensional array with 1000 numbers the following functions behave the oposite i would expect

def test1():
for x in range(10000):
for z, n in enumerate(stack):
y = n*999 # some calculation

def test2():
for x in range(10000):
z = 0 # opengl Z render position
for n in dol(stack):
z+=1 # from botton to top
y = n*999 # some calculation

Basically the 2nd seems to perform far faster than the first, unless i am doing something wrong. I have been checking out some articles about optimising performance in python etc... But i am a bit confused so far.

I was wondering if there is some good but clear game where i could check techniques to improve this.

thanks!

--
altern



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise