Reducing pygame cpu-load to < 4 %
Chris Ball
cjb at laptop.org
Sun Dec 9 18:16:23 EST 2007
Hi,
> Hi! Mcfletch and I have been talking about the heavy cpu-load of
> the wiki's pygame demo: 99%; and how to reduce it.
> We figured out, a combination of pygame.event.wait() and
> pygame.event.get() very good. That's the demo code; it takes less
> than 4% cpu (0.3% - 1.7% here):
That's cool. Note that this won't work for any pygame activity that
wants to do something in the background, though, such as the examples
that Pippy now ships with[1] -- you'll now only enter the event loop
when a keypress happens, even if you've set up a default case to move
something around when there isn't new input to handle.
- Chris.
[1]: http://dev.laptop.org/~cjb/pippy/Pippy-11.xo , with thanks to
Henry Holtzman for the new pygame examples.
--
Chris Ball <cjb at laptop.org>
More information about the Devel
mailing list