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

Re: [pygame] Pygame, clock.ticks() and 42



On Mon, 5 Sep 2005 04:08 am, Pete Shinners wrote:
> On Sat, 2005-09-03 at 21:50 +1000, Richard Jones wrote:
> > During final testing, we noticed something very odd: setting the
> > Clock.ticks() value to 42 (or more) results in 100% CPU utilisation on my
> > computer. 41 barely loads the system (ie. about 5-10% CPU). 42 is evil.
>
> [snip Pete explaining that ticks() busy-waits when FPS passes a certain
> clock precision threshold]
>
> It's not too complicated inside. I'm sure there are actual good
> algorithms to all this, but I'm still a bit naive in regards to
> cross-platform accurate timing. It should be very easy to retool some of
> the logic.

Perhaps someone could look at how mplayer does this?


    Richard

Attachment: pgphey5XWs789.pgp
Description: PGP signature