Jump to content

Recommended Posts

Posted (edited)

At times I see in posts advise to use a way or another for a loop, in this case I'd like to know if:

While 1
Switch GUIGetMsg()
 ... ...
EndSwitch
If $HOUR = @HOUR Then ContinueLoop
$HOUR = @HOUR
someFunc()
Wend

is easier on the CPU than AdlibRegister() would be.

Also, how can I determine whats better, how do you test this.

Thanks

EDIT:  found my answer ( https://www.autoitscript.com/forum/topic/172958-what-is-easier-on-a-cpu/?do=findComment&comment=1251164 )

Edited by argumentum
found my answer

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted (edited)

I don't think your thinking of that correctly, it looks like your while loop is to hold the gui open, and using functions after your guimsg switch vs using adlib isn't going to be easier one way or the other on the cpu. You just need to take care with your other functions that they don't eat cpu cycles so much.  If they do then you could miss gui actions. 

My decent  understanding,could be wrong,or I'm not understanding the question. 

Edited by kaisies
Posted

nope @JLogan3o13, I have not tried anything. I find the "IF $MIN = @MIN THEN" or something like that to be very simple and the impact to today's PCs goes unnoticed. But I got curious on what is less CPU demanding and how can be tested. Even tho I write, I'm not a programmer, know no assembly or anything that would give me the authority to determine how to go about it. But I have seen posts where the better, more efficient mode of writing is presented. So I opened this topic in the hopes that the well versed in the topic share their experience and present a reasonable procedure for testing the possible inefficiencies in the code for ourselves. Maybe there is software written for that purpose. No clue other than what in one's experience, is common sense. 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted

Testing "CPU demanding" isn't hard, you do something 100,000 times one way, and 100,000 times the other way, and see what takes longer.  It doesn't take "assembly", just 5 minutes of programming.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...