[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] optimising render code
- To: pygame-users@xxxxxxxx
- Subject: [pygame] optimising render code
- From: altern <altern2@xxxxxxxxx>
- Date: Sat, 17 Sep 2005 13:14:57 +0200
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Sat, 17 Sep 2005 07:14:02 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:content-type:content-transfer-encoding; b=qLDtL0QppHpOFdUANejcLbmeM+KVU/pu4Fhh5H0eHJ8GhDYtZ9SGpFpjmyDqgumuHdeCATUGlx7gmqZFbENfHiDVIGjHcrTj7pHOPASnMzqaA2O+5j3E9xkQfj6Uha5CfTIkfDzTxJ9pgtU/lWtW9Yy+X3x6utAKjCsiqZMHzZI=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- User-agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716)
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