Hi,
If I run a continuous loop in my script, such as
label>start
gpc>50,50,x
if>x=0,end
goto>start
label>end
my CPU runs at 100% usage. That's way too high for me to run this script throughout the day. I guess this is a two-part question. The first part of the question is this: Is there a CPU fast enough to handle a continuous-loop script without maxing out at 100% CPU usage? I currently have a 3.2GHz machine with 1GB RAM, which seems very fast to me under most circumstances, yet a continuous-loop script maxes out my machine.
Part two of the question is this: If there is no CPU fast enough yet to run continous-loop scripts, does anybody have any thoughts or ideas regarding workarounds to the above script? I'm just using the above script as an example of course. Any continous-loop script will fit under the category of this thread.
Thanks!
Kwhiz
Continuous loops max out my CPU usage. What can I do?
Moderators: JRL, Dorian (MJT support)
This comes up often. Any tight loop in any programming language will consume CPU cycles. Put a small wait inside the loop to ensure each iteration can yield to the processor:
label>start
Wait>0.5
gpc>50,50,x
if>x=0,end
goto>start
label>end
label>start
Wait>0.5
gpc>50,50,x
if>x=0,end
goto>start
label>end
MJT Net Support
[email protected]
[email protected]
-
- Pro Scripter
- Posts: 58
- Joined: Mon Jun 27, 2005 7:03 am
- Location: Switzerland