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

Re: [pygame] 99 CPU use?



hi

I have set the framerate down to 20 and it makes a difference (comes down to 45-60 CPU use), but it is also slower of course.
Is there any tutorial where I could check optimising tricks or techniques?

thanks again



Michael wrote:


I am not sure that this has been discussed before. I have been doing some tests and i realised that when I run any of the apps i am building on pygame they take 99 of my CPU. Then if I try to run some other application it takes forever to start up. I noticed this after realiseing that on a mac G4 laptop every time I run the tests the fan would start spinning at max speed.

Is there any way to avoid this? I understand that if you are playing a game you dont probably want to have any other application runnning on top of the game but if you are using pygame to do something that is not exactly a game, like I am, it becomes a problem. In my case i need to have another application "listening" to pygame to produce sound. this is also a process intense process and pygame takes over the system in such a way that it becomes impossible even to start up the sound environment.

Limiting your framerate seems to make a big difference. Look at the clock part of pygame for info. A lower framerate means less cpu usage. Also you can try running the program as nice so that it doesn't block other processes as much.