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

Re: [pygame] 100% CPU FAQ



techtonik wrote:
Hello,

I do not know why this question is not present in FAQ yet, but - why
pygame always eats 100% of CPU time?

The following example shows 100% load even with empty event queue when
pygame.event.get() is blocking.


Also be aware, the following code will eat 100% cpu.

while 1:
   pass


So obviously Python is an inefficient language. We'll port it to C.

while 1{};

Hmm, this still takes 100% cpu. That must be ineffecient?

The point is, in any programming language, with any library. Running a full loop with no delay or blocking function will always eat 100% cpu, regardless of language or game library.