[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] pygame slowness



Difficult to help without more information and source code.

First thing... you seem to have MANY MANY function calls and lambda functions
... Python function calling is well known to be slow.
Try to unroll some of your most inside loop and in this loop make sure
that all object you are accessing have a local binding.

Then you can try to use some more helpful optimizations
I have managed to multiply by 10 the speed of a complex parser I had
written by going into each function that was too long and making sure
it was not doing something foolish...

Sometimes you might find out that in a loop you end up retraversing
every time a long list...
Check what happens if you multiply your number of object by 10 in your world.
If the system goes 10 times slower, then there is some limiting factor
on the per object basis. If it goes 50-100 times slower... Worries. it
means that you are doing something expensive in a loop that runs
square to the number of objects in your world


Regards,

Guillaume