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

Re: [pygame] Re: 100% CPU



On 4/23/07, Dave LeCompte (really) <dave@xxxxxxxxxxxx> wrote:
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?

Just because you only use 500Mhz of that 2Ghz right *now* doesn't mean
that you wouldn't want to use all 2 Ghz some other time. Basically you
bought something with a max capacity of 2Ghz, because the max capacity
was worth it. It doesn't mean that you need to use it at max capacity
all the time. It strikes as being similar to a car. You definitely
want a car that can go freeway speeds (would suck if it couldn't). But
does that mean buying the car was a waste if you aren't going 65
through the crosswalk?

Sometimes light use is the most desirable use of a resource. Actually
I'd say it is often the most desireable use.


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.

Sure, you are right there. But I think what I find from end users is
that they appreciate it when a game leaves as much of that 99% for
them to pick what to do with. Granted they don't understand it that
way, but when they alt-tab away when paused and the system chugs, or
when the game is choppy when they run email and messenger and web
pages in the background, well they may write in to complain.


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?

Well because not using cycles actually does kind of mean you still
have them. If the electricty wasn't used, it cost you nothing, and the
cost of that electricity is saved up for later. Also, the bank money
could be converted into a resource equally as good as the money, so
even if it could not be saved, spending it is in fact saving it (for
the future). In general the same is not true of the cpu. If the
computer ran a game while you were off at work, does that mean you
would have "more fun" when you got home later and played? Not in any
case I've heard of. But in the money you have more stuff for having
spent it. So they seem to me exactly opposite - saving cycles = saving
money, spending vanishing money = having more stuff

But still - you may be on to a very interesting idea, that if you
could have the computer work when it's not all needed to be able to
provide more fun more cheaply later when all the resources are needed,
that could be useful. Basically some kind of caching.


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 know you are not advocating idiocy, and I'm sorry if I was a bit
rude. I do think you are making very valid points, I just didn't want
the idea that using less cpu is good to be lost.


make use of. Otherwise, I think there's a big pile of unused fun in the
land of wind and ghosts.

Haha...