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

Re: [pygame] Paralax snow flaks: Some tipps for enhancing the performance?



Ludwig Auer wrote:

Some guys in the #pygame irc channel told me to implement the profile module, to figure out, which part of my code thwarts my programm, but it didn't actually work...
It should be very easy to profile your code. Just fire up the interactive prompt, and do this:

>>> import snowflakes # or whatever you named it
>>> import profile
>>> profile.run('snowflakes.main()')

After you exit from your snowflake program, you should see a lot of numbers along with function names. For each function, you'll see:

'ncalls' - the number of times a given function was called. 'tottime' - the total time spent within the function
'cumtime' - the "cumulative time", which is the time spent in that function, plus any functions that were called from within it

Profile it at low resolution, then at high resolution, and see which functions have the greatest increase in time. That should show you where the problem is.

I hope this helps,
Eric Burgess "mojo-"