Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / processor eating program loop

Author
Message
Sleet
21
Years of Service
User Offline
Joined: 3rd Aug 2003
Location:
Posted: 4th May 2004 09:00
I made a simple loop with an if then statement and a sync command. That's it. I find it interesting that even when I set the sync rate down to 5 so it only goes through the loop 5 times a second going through the loop takes between 98% and 99% of my processor speed. I have a 2.4Ghz processor. That doesn't sound right to me.

My current project requires that my program take as little processor bandwith and RAM as possible so, is there a way to do that or will my programs always hijack my computer entirely?
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 4th May 2004 14:03
IF/THEN isn't a loop, what exactly is your code doing?

It is highly likely that any size of loop will devour your CPU with great pleasure, if it's badly coded. It will do this in any language.

A low SYNC rate could potentially be worse than a high SYNC rate. Why? Because AFAIK it's the SYNC that releases the processor back to Windows. So you are only letting Windows manage the system resources once every 200 milliseconds.

BatVink
http://facepaint.me.uk/catalog/default.php AMD 3000+ Barton, 512Mb Ram, 120 Gig Drive space, GeForce 5200 FX 128 Mb, Asus A7N8X Mobo.
Terms & Conditions apply
M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 4th May 2004 15:55
A simple if then wont eat all of the CPU. It must be an error on your part. Post your code.

Sleet
21
Years of Service
User Offline
Joined: 3rd Aug 2003
Location:
Posted: 4th May 2004 21:16 Edited at: 4th May 2004 21:18


just the loop, sync rate 5, sync rate 1000, takes up 98%-99% of my cpu according to my taskmanager and it isn't lying to me because applications freeze and won't open etc.......
M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 7th May 2004 16:33
Make the code into an exe and execute it, then see if the problem persists.

BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 10th May 2004 07:26
Also, if your computer is kind of slow (for example, mine: 1300mhz celeron, Geforce 2 MX, Soundblast Live! 5.1, 256mb ram), using windows will kill your cpu.

Crazy Donut Productions, Current Project: KillZone
Web Site Button Does Not Work, Visit Here: http://www.geocities.com/crazydonutproductions/index.html
the desktops
21
Years of Service
User Offline
Joined: 9th Oct 2003
Location:
Posted: 10th May 2004 21:44 Edited at: 10th May 2004 21:45
Man I have 2 systems!! I have a Packard Bell Cyrix that's running at 224MHZ with Windows XP and still it runs pretty good at 25-37 fps. If you have Windows XP, you can always change the compatibility settings to Windows 98/ME and it will run much faster! Trust Me! I don't have to worry about my other system the Athlon 64 FX

Soul Shooter Online
XPlay Multiplayer Engine
Sleet
21
Years of Service
User Offline
Joined: 3rd Aug 2003
Location:
Posted: 18th May 2004 06:52
I don't think you guys are quite getting it. I did like the idea of amking it into an .exe but it didn't work

I'm not having problems running MY program, the problem is running OTHER programs WHILE my program is running. Try running the program while playing your favorite game, I'm almost certain that you're gonna have problems, especialy if it's a good sized game. I have problems running programs that take 200Mhz (or so they say) while running that loop I posted above

Login to post a reply

Server time is: 2025-05-23 20:21:42
Your offset time is: 2025-05-23 20:21:42