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

Re: [pygame] Whoa! Bad slowdown!



Use python's cProfile module to quickly pinpoint the slowest parts of 
your code.

http://docs.python.org/library/profile.html

---
James Paige

On Tue, Apr 12, 2011 at 04:02:35PM -0700, Julian Marchant wrote:
>    I have actually mentioned this project of mine on this list before, but it
>    was about a Windows-specific issue. This time, it's about slowdown. Now,
>    my laptop is very low-end, so it's not surprising to me when I experience
>    lag in particularly graphically-intensive games, but this is ridiculous.
> 
>    All the files of my project can be found in this download:
>    http://www.mediafire.com/?pbr8kubwu9q7vg0
> 
>    The slowdown I'm experiencing (under Fedora 14/GNOME, at least) is a
>    ridiculous level. Each frame takes something like 10-20 seconds, which is
>    just plain unimaginable. I have looked through my code, and I find nothing
>    which should cause this massive scale of slowdown. A fair amount of stuff
>    happens, and even some pixel work with surfarray happens, but I would not
>    expect any less than maybe 10 FPS, and that's really stretching it.
> 
>    Most of the slowdown seems to occur in the PlayerSprite.update and
>    PlayerView.update methods. Looking at the system monitor, it seems that
>    the program is eating up clock cycles like a starving lion. My question
>    is: can anyone see a good reason why these methods would cause as much
>    slowdown as they do? If so, any recommendations for optimizing it better?
> 
>    Thanks! :)