Jump to content

what is easier on a CPU [Answered]


Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators

Maybe an ADLIB would take less flip-flops. Maybe the IF THEN is queued. No clue.

​Have you tried it yourself? What did you experience?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...