Jump to content

reduce cpu usage


Recommended Posts

  • Developers

im pretty sure i read a thread some while back about reducing cpu usage.. i dont know if it can help me much but if anyone has any code that can reduce the cpu usage it'd be appreciated

This really depends on the script you are making but in While..Wend or Do..Until loops you sometimes need a Sleep(10) to slow the script down....

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

one could also reduce memory use by cut off all unitiated msg returns right in the start of a while/end like this...

While 1

$msg = GUIGetMsg(1)

Select

Case $msg[1] = 0 // cut off non initiated returns

Case $msg[1] = $MainWin

Case etc.

Endselect

In this manner your script do not have to evaluate all the unnessesary zeros doing all the CASE entries...

kjactive ;)

Edited by kjactive
Link to comment
Share on other sites

alienkillaz is talking about 'reducing cpu usage' and that's not the same as memory reduce. CPU do in normal conditions not use any memory while memory use a little CPU to hold a program in memory but the actually calculations is done by the cpu and in any other languages when there is nothing going on, the 'cpu sleeps' so to speak...

Autoit3 gui has another way to work and a problematic cpu use as autoit tics ( returns a message ) at 250 times a second as default ( can be changed ) even if there is nothing going on and that's to update all the automatically functions like to catch external lists etc. but if one has a while / WEnd script with lots of Cases to evaluate this would take up some CPU usage to evaluate well quiet a lot actually and If one has two or three scripts going on at the same time - the cpu could reatch near a limit border...

That's why I catch all uninitiated msg message returns right at the beginning so the script do not has to read and evaluate any unnessasary tics and save some cpu time...

Autoit3 gui works in most conditions but one has to be carefully planning CPU usage to be shure to unvoide problems or conflickts in future, I say anyway...

kjactive ;)

Edited by kjactive
Link to comment
Share on other sites

alienkillaz is talking about 'reducing cpu usage' and that's not the same as memory reduce. CPU do in normal conditions not use any memory while memory use a little CPU to hold a program in memory but the actually calculations is done by the cpu and in any other languages when there is nothing going on, the 'cpu sleeps' so to speak...

Autoit3 gui has another way to work and a problematic cpu use as autoit tics ( returns a message ) at 250 times a second as default ( can be changed ) even if there is nothing going on and that's to update all the automatically functions like to catch external lists etc. but if one has a while / WEnd script with lots of Cases to evaluate this would take up some CPU usage to evaluate well quiet a lot actually and If one has two or three scripts going on at the same time - the cpu could reatch near a limit border...

That's why I catch all uninitiated msg message returns right at the beginning so the script do not has to read and evaluate any unnessasary tics and save some cpu time...

Autoit3 gui works in most conditions but one has to be carefully planning CPU usage to be shure to unvoide problems or conflickts in future, I say anyway...

kjactive ;)

i am aware of the difference but....

1

i think like a hobbyist

2

there is no code ( that i am aware of ) to reduce CPU usage

3

he clearly states there was a thread about it

4

i took a shot in the dark

thanks kjactive

8)

NEWHeader1.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...