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

Re: [pygame] Re: 100% CPU



Brian Fisher told me that a CPU is not a saw:
> However it is also nowhere near an applicable analogy in this case. So
> if you only ever used 20% of the cpu, I guess you'll burn out that 20%
> and then have to throw away an 80% good cpu? What a waste. All those
> 80% good intel CPU's lounging in a trash heap!

Ok, so I'm not burning out 20% of the pins on the CPU, or wearing down 20%
of the transistors to nubs, but I still believe it's valid. If I have a
2GHz CPU, and I only use 20% of it over its entire lifetime, didn't I
really waste 80% of my CPU? I could have saved some cash and bought myself
a 500MHz CPU, and got the same number of calculations out of it, right?


You mention that it's a good idea to set aside 1% of the CPU to be used by
the OS, and that's probably a very good rule of thumb - by all means, let
the high priority apps hit the CPU to do what they need to do, but the
remainder of the processing power of the machine is ripe to be used.


> ...I'm not sure where you got the idea that if you somehow don't use
> an available cycle from your cpu it gets lost to the land of wind and
> ghosts, but I think it's awesome.

That's a cool image. But if the available cycles aren't lost, how would
you describe them? I can't go back and use them now, so how is that
different from my malicious bank account metaphor?


Oh, and perhaps someone's thinking that I'm advocating doing a busy wait
during idle times - certainly not. A busy wait (spinning the CPU, checking
some exit case), when a sleep or other well-implemented blocking call is
available, is a waste of CPU.

I'm just saying that the CPU is a device for turning electricity into fun.
If you can use more of the CPU to make more fun, then do so. Some games
really do have an upper limit of instructions per second that they can
make use of. Otherwise, I think there's a big pile of unused fun in the
land of wind and ghosts.


-Dave LeCompte